git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] config: Add new option to open an editor.
@ 2009-02-03 22:40 Felipe Contreras
  2009-02-03 22:53 ` Johannes Schindelin
  2009-02-04 14:53 ` Jeff King
  0 siblings, 2 replies; 25+ messages in thread
From: Felipe Contreras @ 2009-02-03 22:40 UTC (permalink / raw)
  To: git; +Cc: Felipe Contreras

The idea was originated by discussion about usability of manually
editing the config file in 'special needs' systems such as Windows. Now
the user can forget a bit about where the config files actually are.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 Documentation/git-config.txt |    6 ++++++
 builtin-config.c             |   11 ++++++++++-
 2 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/Documentation/git-config.txt b/Documentation/git-config.txt
index 19a8917..7d14007 100644
--- a/Documentation/git-config.txt
+++ b/Documentation/git-config.txt
@@ -22,6 +22,7 @@ SYNOPSIS
 'git config' [<file-option>] [-z|--null] -l | --list
 'git config' [<file-option>] --get-color name [default]
 'git config' [<file-option>] --get-colorbool name [stdout-is-tty]
+'git config' [<file-option>] -e | --edit
 
 DESCRIPTION
 -----------
@@ -157,6 +158,11 @@ See also <<FILES>>.
 	output.  The optional `default` parameter is used instead, if
 	there is no color configured for `name`.
 
+-e::
+--edit::
+	Opens an editor to modify the specified config file; either
+	'--system', '--global', or repository (default).
+
 [[FILES]]
 FILES
 -----
diff --git a/builtin-config.c b/builtin-config.c
index f710162..b0a86b1 100644
--- a/builtin-config.c
+++ b/builtin-config.c
@@ -3,7 +3,7 @@
 #include "color.h"
 
 static const char git_config_set_usage[] =
-"git config [ --global | --system | [ -f | --file ] config-file ] [ --bool | --int | --bool-or-int ] [ -z | --null ] [--get | --get-all | --get-regexp | --replace-all | --add | --unset | --unset-all] name [value [value_regex]] | --rename-section old_name new_name | --remove-section name | --list | --get-color var [default] | --get-colorbool name [stdout-is-tty]";
+"git config [ --global | --system | [ -f | --file ] config-file ] [ --bool | --int | --bool-or-int ] [ -z | --null ] [--get | --get-all | --get-regexp | --replace-all | --add | --unset | --unset-all] name [value [value_regex]] | --rename-section old_name new_name | --remove-section name | --list | --get-color var [default] | --get-colorbool name [stdout-is-tty] | --edit | -e ]";
 
 static char *key;
 static regex_t *key_regexp;
@@ -362,6 +362,15 @@ int cmd_config(int argc, const char **argv, const char *prefix)
 			return get_color(argc-2, argv+2);
 		} else if (!strcmp(argv[1], "--get-colorbool")) {
 			return get_colorbool(argc-2, argv+2);
+		} else if (!strcmp(argv[1], "--edit") || !strcmp(argv[1], "-e")) {
+			char *config_filename;
+			if (config_exclusive_filename)
+				config_filename = xstrdup(config_exclusive_filename);
+			else
+				config_filename = git_pathdup("config");
+			launch_editor(config_filename, NULL, NULL);
+			free(config_filename);
+			return 0;
 		} else
 			break;
 		argc--;
-- 
1.6.1.2

^ permalink raw reply related	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2009-02-07 21:54 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-03 22:40 [PATCH] config: Add new option to open an editor Felipe Contreras
2009-02-03 22:53 ` Johannes Schindelin
2009-02-03 22:56   ` Felipe Contreras
2009-02-03 23:05     ` Johannes Schindelin
2009-02-03 23:25       ` Felipe Contreras
2009-02-03 23:26         ` Felipe Contreras
2009-02-03 23:31         ` Johannes Schindelin
2009-02-03 23:43           ` Felipe Contreras
2009-02-04 14:53 ` Jeff King
2009-02-04 15:03   ` Felipe Contreras
2009-02-04 15:18     ` Jeff King
2009-02-04 15:41       ` Felipe Contreras
2009-02-04 22:34         ` [PATCH v3] " Felipe Contreras
2009-02-04 23:16           ` Junio C Hamano
2009-02-04 23:39             ` Felipe Contreras
2009-02-04 23:43             ` Johannes Schindelin
2009-02-04 23:49               ` Johannes Schindelin
2009-02-07 21:09                 ` Felipe Contreras
2009-02-07 21:14                   ` Johannes Schindelin
2009-02-07 21:15                     ` Felipe Contreras
2009-02-07 21:34                       ` Junio C Hamano
2009-02-07 21:50                         ` Felipe Contreras
2009-02-07 21:53                           ` [PATCH] " Felipe Contreras
2009-02-04 15:20     ` Johannes Schindelin
2009-02-04 15:42       ` Felipe Contreras

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).