{"thread":{"id":"33360","subject":"[PATCH V3 1/5] Show help: -a and -g option, and 'git help <concept>' usage.","startedAt":"2013-04-02T22:39:47Z","lastAt":"2013-04-12T16:16:30Z","messageCount":16,"participants":["Philip Oakley","Junio C Hamano","Eric Sunshine","Simon Ruderich"],"isPatch":true,"patchVersion":3,"patchTotal":5},"messages":[{"id":"213004","messageId":"1364942392-576-1-git-send-email-philipoakley@iee.org","threadId":"33360","inReplyTo":null,"subject":"[PATCH V3 0/5] Git help option to list user guides","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":"2013-04-02T22:39:47Z","receivedAt":"2013-04-02T22:39:47Z","isPatch":true,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"This is the re-roll of $gmane/217384. The series seeks to provide a help\noption that will list the common git guides, and how to access them.\n\nThe series is rebased on top of V1.8.2 \n\nSince V2, the OPT_BOOL is now used instead of OPT_COUNTUP.\nThe git_more_info_string has been further updated inline with Junio's\nsuggestions, and re-spaced so that command example are not split over\nline ends.\n\nJunio's suggestions in $gmane/217354/focus=217355 have been included.\nJunio also asked about the `if (!argv[0])` test which is, correctly,\nperformed _after_ the -a and -g options are taken, as they overide any\nremaining arguments.\n\nThe list of guides is spaced out in the same manner as the common\ncommand list.\n\nPhilip Oakley (5):\n  Show help: -a and -g option, and 'git help <concept>' usage.\n  Help.c use OPT_BOOL and refactor logic\n  Help.c add --guide option\n  Help.c: add list_common_guides_help() function\n  Help doc: Include --guide option description\n\n Documentation/git-help.txt | 30 ++++++++++++++++++++++--------\n builtin/help.c             | 17 +++++++++++++++--\n common-guides.h            | 11 +++++++++++\n git.c                      |  4 +++-\n help.c                     | 18 ++++++++++++++++++\n help.h                     |  1 +\n 6 files changed, 70 insertions(+), 11 deletions(-)\n create mode 100644 common-guides.h\n\n-- \n1.8.1.msysgit.1\n"},{"id":"213001","messageId":"1364942392-576-2-git-send-email-philipoakley@iee.org","threadId":"33360","inReplyTo":"1364942392-576-1-git-send-email-philipoakley@iee.org","subject":"[PATCH V3 1/5] Show help: -a and -g option, and 'git help <concept>' usage.","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":"2013-04-02T22:39:48Z","receivedAt":"2013-04-02T22:39:48Z","isPatch":true,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"Prepare for the addition of the -g --guides option to git help\nand show that help is available for both concept guides, and commands.\n\nSigned-off-by: Philip Oakley <philipoakley@iee.org>\n---\n git.c | 4 +++-\n 1 file changed, 3 insertions(+), 1 deletion(-)\n\ndiff --git a/git.c b/git.c\nindex 39ba6b1..2f8aa41 100644\n--- a/git.c\n+++ b/git.c\n@@ -13,7 +13,9 @@ const char git_usage_string[] =\n \t\"           <command> [<args>]\";\n \n const char git_more_info_string[] =\n-\tN_(\"See 'git help <command>' for more information on a specific command.\");\n+\tN_(\"'git help -a' and 'git help -g' lists available subcommands and some\\n\"\n+\t   \"concept guides. See 'git help <command>' or 'git help <concept>'\\n\"\n+\t   \"to read about a specific subcommand or concept.\");\n \n static struct startup_info git_startup_info;\n static int use_pager = -1;\n-- \n1.8.1.msysgit.1\n"},{"id":"213006","messageId":"1364942392-576-3-git-send-email-philipoakley@iee.org","threadId":"33360","inReplyTo":"1364942392-576-1-git-send-email-philipoakley@iee.org","subject":"[PATCH V3 2/5] Help.c use OPT_BOOL and refactor logic","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":"2013-04-02T22:39:49Z","receivedAt":"2013-04-02T22:39:49Z","isPatch":true,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"Rename deprecated OPT_BOOLEAN option to OPT_BOOL in preparation for\n'git help --guides'. The former OPT_BOOLEAN would now be OPT_COUNTUP,\nbut that capability is not required.\n\nSeparate out the show_all 'return(0)' and git_more_info_string logic\nready for inclusion of show_guides.\n\nSigned-off-by: Philip Oakley <philipoakley@iee.org>\n---\n builtin/help.c | 8 +++++++-\n 1 file changed, 7 insertions(+), 1 deletion(-)\n\ndiff --git a/builtin/help.c b/builtin/help.c\nindex d1d7181..8969d3b 100644\n--- a/builtin/help.c\n+++ b/builtin/help.c\n@@ -39,7 +39,7 @@ static int show_all = 0;\n static unsigned int colopts;\n static enum help_format help_format = HELP_FORMAT_NONE;\n static struct option builtin_help_options[] = {\n-\tOPT_BOOLEAN('a', \"all\", &show_all, N_(\"print all available commands\")),\n+\tOPT_BOOL('a', \"all\", &show_all, N_(\"print all available commands\")),\n \tOPT_SET_INT('m', \"man\", &help_format, N_(\"show man page\"), HELP_FORMAT_MAN),\n \tOPT_SET_INT('w', \"web\", &help_format, N_(\"show manual in web browser\"),\n \t\t\tHELP_FORMAT_WEB),\n@@ -428,7 +428,13 @@ int cmd_help(int argc, const char **argv, const char *prefix)\n \t\tgit_config(git_help_config, NULL);\n \t\tprintf(_(\"usage: %s%s\"), _(git_usage_string), \"\\n\\n\");\n \t\tlist_commands(colopts, &main_cmds, &other_cmds);\n+\t}\n+\n+\tif (show_all) {\n \t\tprintf(\"%s\\n\", _(git_more_info_string));\n+\t\t/*\n+\t\t* We're done. Ignore any remaining args\n+\t\t*/\n \t\treturn 0;\n \t}\n \n-- \n1.8.1.msysgit.1\n"},{"id":"213002","messageId":"1364942392-576-4-git-send-email-philipoakley@iee.org","threadId":"33360","inReplyTo":"1364942392-576-1-git-send-email-philipoakley@iee.org","subject":"[PATCH V3 3/5] Help.c add --guide option","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":"2013-04-02T22:39:50Z","receivedAt":"2013-04-02T22:39:50Z","isPatch":true,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"Logic, but no actions, included.\n\nThe --all commands option, if given, will display first.\nThe --guide option's list will then be displayed.\n\nThe common commands list is only displayed if neither option,\nnor a command or guide name, is given.\n\nSigned-off-by: Philip Oakley <philipoakley@iee.org>\n---\n builtin/help.c | 10 ++++++++--\n 1 file changed, 8 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin/help.c b/builtin/help.c\nindex 8969d3b..03d432b 100644\n--- a/builtin/help.c\n+++ b/builtin/help.c\n@@ -36,10 +36,12 @@ enum help_format {\n static const char *html_path;\n \n static int show_all = 0;\n+static int show_guides = 0;\n static unsigned int colopts;\n static enum help_format help_format = HELP_FORMAT_NONE;\n static struct option builtin_help_options[] = {\n \tOPT_BOOL('a', \"all\", &show_all, N_(\"print all available commands\")),\n+\tOPT_BOOL('g', \"guides\", &show_guides, N_(\"print list of useful guides\")),\n \tOPT_SET_INT('m', \"man\", &help_format, N_(\"show man page\"), HELP_FORMAT_MAN),\n \tOPT_SET_INT('w', \"web\", &help_format, N_(\"show manual in web browser\"),\n \t\t\tHELP_FORMAT_WEB),\n@@ -49,7 +51,7 @@ static struct option builtin_help_options[] = {\n };\n \n static const char * const builtin_help_usage[] = {\n-\tN_(\"git help [--all] [--man|--web|--info] [command]\"),\n+\tN_(\"git help [--all] [--guides] [--man|--web|--info] [command]\"),\n \tNULL\n };\n \n@@ -430,7 +432,11 @@ int cmd_help(int argc, const char **argv, const char *prefix)\n \t\tlist_commands(colopts, &main_cmds, &other_cmds);\n \t}\n \n-\tif (show_all) {\n+\tif (show_guides) {\n+\t\t/* do action - next patch */\n+\t}\n+\n+\tif (show_all || show_guides) {\n \t\tprintf(\"%s\\n\", _(git_more_info_string));\n \t\t/*\n \t\t* We're done. Ignore any remaining args\n-- \n1.8.1.msysgit.1\n"},{"id":"213005","messageId":"1364942392-576-5-git-send-email-philipoakley@iee.org","threadId":"33360","inReplyTo":"1364942392-576-1-git-send-email-philipoakley@iee.org","subject":"[PATCH V3 4/5] Help.c: add list_common_guides_help() function","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":"2013-04-02T22:39:51Z","receivedAt":"2013-04-02T22:39:51Z","isPatch":true,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"Re-use list_common_cmds_help but simply change the array name.\nCandidate for future refactoring to pass a pointer to the array.\n\nThe common-guides.h list was generated with a simple variant of the\ngenerate-cmdlist.sh and command-list.txt.\n\nDo not list User-manual and Everday Git which not follow the naming\nconvention, nor gitrepository-layout which doesn't fit within the\nname field size.\n\nSigned-off-by: Philip Oakley <philipoakley@iee.org>\n---\n builtin/help.c  |  3 ++-\n common-guides.h | 11 +++++++++++\n help.c          | 18 ++++++++++++++++++\n help.h          |  1 +\n 4 files changed, 32 insertions(+), 1 deletion(-)\n create mode 100644 common-guides.h\n\ndiff --git a/builtin/help.c b/builtin/help.c\nindex 03d432b..91a6158 100644\n--- a/builtin/help.c\n+++ b/builtin/help.c\n@@ -433,7 +433,8 @@ int cmd_help(int argc, const char **argv, const char *prefix)\n \t}\n \n \tif (show_guides) {\n-\t\t/* do action - next patch */\n+\t\tlist_common_guides_help();\n+\t\tprintf(\"\\n\");\n \t}\n \n \tif (show_all || show_guides) {\ndiff --git a/common-guides.h b/common-guides.h\nnew file mode 100644\nindex 0000000..0e94fdc\n--- /dev/null\n+++ b/common-guides.h\n@@ -0,0 +1,11 @@\n+/* re-use struct cmdname_help in common-commands.h */\n+\n+static struct cmdname_help common_guides[] = {\n+  {\"attributes\", \"defining attributes per path\"},\n+  {\"glossary\", \"A GIT Glossary\"},\n+  {\"ignore\", \"Specifies intentionally untracked files to ignore\"},\n+  {\"modules\", \"defining submodule properties\"},\n+  {\"revisions\", \"specifying revisions and ranges for git\"},\n+  {\"tutorial\", \"A tutorial introduction to git (for version 1.5.1 or newer)\"},\n+  {\"workflows\", \"An overview of recommended workflows with git\"},\n+};\ndiff --git a/help.c b/help.c\nindex 1dfa0b0..e0368ca 100644\n--- a/help.c\n+++ b/help.c\n@@ -4,6 +4,7 @@\n #include \"levenshtein.h\"\n #include \"help.h\"\n #include \"common-cmds.h\"\n+#include \"common-guides.h\"\n #include \"string-list.h\"\n #include \"column.h\"\n #include \"version.h\"\n@@ -240,6 +241,23 @@ void list_common_cmds_help(void)\n \t}\n }\n \n+void list_common_guides_help(void)\n+{\n+\tint i, longest = 0;\n+\n+\tfor (i = 0; i < ARRAY_SIZE(common_guides); i++) {\n+\t\tif (longest < strlen(common_guides[i].name))\n+\t\t\tlongest = strlen(common_guides[i].name);\n+\t}\n+\n+\tputs(_(\"The common Git guides are:\\n\"));\n+\tfor (i = 0; i < ARRAY_SIZE(common_guides); i++) {\n+\t\tprintf(\"   %s   \", common_guides[i].name);\n+\t\tmput_char(' ', longest - strlen(common_guides[i].name));\n+\t\tputs(_(common_guides[i].help));\n+\t}\n+}\n+\n int is_in_cmdlist(struct cmdnames *c, const char *s)\n {\n \tint i;\ndiff --git a/help.h b/help.h\nindex 0ae5a12..4ae1fd7 100644\n--- a/help.h\n+++ b/help.h\n@@ -17,6 +17,7 @@ static inline void mput_char(char c, unsigned int num)\n }\n \n extern void list_common_cmds_help(void);\n+extern void list_common_guides_help(void);\n extern const char *help_unknown_cmd(const char *cmd);\n extern void load_command_list(const char *prefix,\n \t\t\t      struct cmdnames *main_cmds,\n-- \n1.8.1.msysgit.1\n"},{"id":"213003","messageId":"1364942392-576-6-git-send-email-philipoakley@iee.org","threadId":"33360","inReplyTo":"1364942392-576-1-git-send-email-philipoakley@iee.org","subject":"[PATCH V3 5/5] Help doc: Include --guide option description","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":"2013-04-02T22:39:52Z","receivedAt":"2013-04-02T22:39:52Z","isPatch":true,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"Note that the ability to display an individual guide was\nalways possible. Include this in the update.\n\nAlso tell readers how git(1) can be accessed, especially for\nGit for Windows users who do not have the 'man' command.\nLikewise include a commentary on how to access this page (Catch 22).\n\nSigned-off-by: Philip Oakley <philipoakley@iee.org>\n---\n Documentation/git-help.txt | 30 ++++++++++++++++++++++--------\n 1 file changed, 22 insertions(+), 8 deletions(-)\n\ndiff --git a/Documentation/git-help.txt b/Documentation/git-help.txt\nindex e07b6dc..442d941 100644\n--- a/Documentation/git-help.txt\n+++ b/Documentation/git-help.txt\n@@ -8,31 +8,45 @@ git-help - Display help information about Git\n SYNOPSIS\n --------\n [verse]\n-'git help' [-a|--all|-i|--info|-m|--man|-w|--web] [COMMAND]\n+'git help' [-a|--all] [-g|--guide]\n+\t   [-i|--info|-m|--man|-w|--web] [COMMAND|GUIDE]\n \n DESCRIPTION\n -----------\n \n-With no options and no COMMAND given, the synopsis of the 'git'\n+With no options and no COMMAND or GUIDE given, the synopsis of the 'git'\n command and a list of the most commonly used Git commands are printed\n on the standard output.\n \n-If the option '--all' or '-a' is given, then all available commands are\n+If the option '--all' or '-a' is given, all available commands are\n printed on the standard output.\n \n-If a Git subcommand is named, a manual page for that subcommand is brought\n-up. The 'man' program is used by default for this purpose, but this\n-can be overridden by other options or configuration variables.\n+If the option '--guide' or '-g' is given, a list of the useful\n+Git guides is also printed on the standard output.\n \n-Note that `git --help ...` is identical to `git help ...` because the\n+If a command, or a guide, is given, a manual page for that command or\n+guide is brought up. The 'man' program is used by default for this\n+purpose, but this can be overridden by other options or configuration\n+variables.\n+\n+Note that 'git --help ...' is identical to 'git help ...' because the\n former is internally converted into the latter.\n \n+To display the linkgit:git[1] man page, use 'git help git'.\n+\n+This page can be displayed with 'git help help' or 'git help --help'\n+\n OPTIONS\n -------\n -a::\n --all::\n \tPrints all the available commands on the standard output. This\n-\toption supersedes any other option.\n+\toption overides any given command or guide name.\n+\n+-g::\n+--guides::\n+\tPrints a list of useful guides on the standard output. This\n+\toption overides any given command or guide name.\n \n -i::\n --info::\n-- \n1.8.1.msysgit.1\n"},{"id":"213008","messageId":"7vobdw8r6w.fsf@alter.siamese.dyndns.org","threadId":"33360","inReplyTo":"1364942392-576-5-git-send-email-philipoakley@iee.org","subject":"Re: [PATCH V3 4/5] Help.c: add list_common_guides_help() function","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-04-02T23:10:15Z","receivedAt":"2013-04-02T23:10:15Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Philip Oakley <philipoakley@iee.org> writes:\n\n> Re-use list_common_cmds_help but simply change the array name.\n> Candidate for future refactoring to pass a pointer to the array.\n>\n> The common-guides.h list was generated with a simple variant of the\n> generate-cmdlist.sh and command-list.txt.\n>\n> Do not list User-manual and Everday Git which not follow the naming\n> convention, nor gitrepository-layout which doesn't fit within the\n> name field size.\n>\n> Signed-off-by: Philip Oakley <philipoakley@iee.org>\n> ---\n>  builtin/help.c  |  3 ++-\n>  common-guides.h | 11 +++++++++++\n>  help.c          | 18 ++++++++++++++++++\n>  help.h          |  1 +\n>  4 files changed, 32 insertions(+), 1 deletion(-)\n>  create mode 100644 common-guides.h\n>\n> diff --git a/builtin/help.c b/builtin/help.c\n> index 03d432b..91a6158 100644\n> --- a/builtin/help.c\n> +++ b/builtin/help.c\n> @@ -433,7 +433,8 @@ int cmd_help(int argc, const char **argv, const char *prefix)\n>  \t}\n>  \n>  \tif (show_guides) {\n> -\t\t/* do action - next patch */\n> +\t\tlist_common_guides_help();\n> +\t\tprintf(\"\\n\");\n>  \t}\n\nThis looks funny.  If you look at list_commands() that this patch is\nmimicking, you will notice that the \"trailing blank for clarity\" is\ndone as part of the function, not done by the caller.  I think it is\nbetter done the same way.\n\n> diff --git a/common-guides.h b/common-guides.h\n> new file mode 100644\n> index 0000000..0e94fdc\n> --- /dev/null\n> +++ b/common-guides.h\n> @@ -0,0 +1,11 @@\n> +/* re-use struct cmdname_help in common-commands.h */\n> +\n> +static struct cmdname_help common_guides[] = {\n> +  {\"attributes\", \"defining attributes per path\"},\n> +  {\"glossary\", \"A GIT Glossary\"},\n> +  {\"ignore\", \"Specifies intentionally untracked files to ignore\"},\n> +  {\"modules\", \"defining submodule properties\"},\n> +  {\"revisions\", \"specifying revisions and ranges for git\"},\n> +  {\"tutorial\", \"A tutorial introduction to git (for version 1.5.1 or newer)\"},\n> +  {\"workflows\", \"An overview of recommended workflows with git\"},\n> +};\n\nThe _only_ reason we have common-cmds.h as a separat file even\nthough it defines data (hence should not be included in more than\none *.c file) is because it is a generated file.\n\nFor this array, there is no reason to have it in a separate header\nfile.  Just define it immediately before list_common_guies_help()\nfunction that is the sole user of the array.\n\nThe function can live in builtin/help.c as a static, without\ntouching global help.c nor help.h, no?  Is there a reason why it\nshould be callable from other places?\n\n> diff --git a/help.c b/help.c\n> index 1dfa0b0..e0368ca 100644\n> --- a/help.c\n> +++ b/help.c\n> @@ -4,6 +4,7 @@\n>  #include \"levenshtein.h\"\n>  #include \"help.h\"\n>  #include \"common-cmds.h\"\n> +#include \"common-guides.h\"\n>  #include \"string-list.h\"\n>  #include \"column.h\"\n>  #include \"version.h\"\n> @@ -240,6 +241,23 @@ void list_common_cmds_help(void)\n>  \t}\n>  }\n>  \n> +void list_common_guides_help(void)\n> +{\n> +\tint i, longest = 0;\n> +\n> +\tfor (i = 0; i < ARRAY_SIZE(common_guides); i++) {\n> +\t\tif (longest < strlen(common_guides[i].name))\n> +\t\t\tlongest = strlen(common_guides[i].name);\n> +\t}\n> +\n> +\tputs(_(\"The common Git guides are:\\n\"));\n> +\tfor (i = 0; i < ARRAY_SIZE(common_guides); i++) {\n> +\t\tprintf(\"   %s   \", common_guides[i].name);\n> +\t\tmput_char(' ', longest - strlen(common_guides[i].name));\n> +\t\tputs(_(common_guides[i].help));\n> +\t}\n> +}\n> +\n>  int is_in_cmdlist(struct cmdnames *c, const char *s)\n>  {\n>  \tint i;\n> diff --git a/help.h b/help.h\n> index 0ae5a12..4ae1fd7 100644\n> --- a/help.h\n> +++ b/help.h\n> @@ -17,6 +17,7 @@ static inline void mput_char(char c, unsigned int num)\n>  }\n>  \n>  extern void list_common_cmds_help(void);\n> +extern void list_common_guides_help(void);\n>  extern const char *help_unknown_cmd(const char *cmd);\n>  extern void load_command_list(const char *prefix,\n>  \t\t\t      struct cmdnames *main_cmds,\n"},{"id":"213009","messageId":"7vk3ok8r55.fsf@alter.siamese.dyndns.org","threadId":"33360","inReplyTo":"1364942392-576-6-git-send-email-philipoakley@iee.org","subject":"Re: [PATCH V3 5/5] Help doc: Include --guide option description","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-04-02T23:11:18Z","receivedAt":"2013-04-02T23:11:18Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Philip Oakley <philipoakley@iee.org> writes:\n\n> +To display the linkgit:git[1] man page, use 'git help git'.\n\nGood to see that somebody remembers that we discussed this ;-)\n"},{"id":"213010","messageId":"7vd2uc8qyh.fsf@alter.siamese.dyndns.org","threadId":"33360","inReplyTo":"1364942392-576-2-git-send-email-philipoakley@iee.org","subject":"Re: [PATCH V3 1/5] Show help: -a and -g option, and 'git help <concept>' usage.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-04-02T23:15:18Z","receivedAt":"2013-04-02T23:15:18Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Philip Oakley <philipoakley@iee.org> writes:\n\n> Prepare for the addition of the -g --guides option to git help\n> and show that help is available for both concept guides, and commands.\n>\n> Signed-off-by: Philip Oakley <philipoakley@iee.org>\n> ---\n\nThis should come at the end after you taught the \"-g\" option, I\nthink.  If we stopped with 1/5, then the message will promise \"git\nhelp -g\" does something useful, while the code is not yet ready.\n\n>  git.c | 4 +++-\n>  1 file changed, 3 insertions(+), 1 deletion(-)\n>\n> diff --git a/git.c b/git.c\n> index 39ba6b1..2f8aa41 100644\n> --- a/git.c\n> +++ b/git.c\n> @@ -13,7 +13,9 @@ const char git_usage_string[] =\n>  \t\"           <command> [<args>]\";\n>  \n>  const char git_more_info_string[] =\n> -\tN_(\"See 'git help <command>' for more information on a specific command.\");\n> +\tN_(\"'git help -a' and 'git help -g' lists available subcommands and some\\n\"\n> +\t   \"concept guides. See 'git help <command>' or 'git help <concept>'\\n\"\n> +\t   \"to read about a specific subcommand or concept.\");\n>  \n>  static struct startup_info git_startup_info;\n>  static int use_pager = -1;\n"},{"id":"213011","messageId":"7v62048qxm.fsf@alter.siamese.dyndns.org","threadId":"33360","inReplyTo":"1364942392-576-3-git-send-email-philipoakley@iee.org","subject":"Re: [PATCH V3 2/5] Help.c use OPT_BOOL and refactor logic","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-04-02T23:15:49Z","receivedAt":"2013-04-02T23:15:49Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Philip Oakley <philipoakley@iee.org> writes:\n\n> Rename deprecated OPT_BOOLEAN option to OPT_BOOL in preparation for\n> 'git help --guides'. The former OPT_BOOLEAN would now be OPT_COUNTUP,\n> but that capability is not required.\n>\n> Separate out the show_all 'return(0)' and git_more_info_string logic\n> ready for inclusion of show_guides.\n>\n> Signed-off-by: Philip Oakley <philipoakley@iee.org>\n> ---\n\nYou are creating a gap in the output so that you can add some more\nstuff in later patches, which is fine, but I do not think we call\nthat kind of change a \"refactor\" ;-).\n\nThe change looks fine.\n\n>  builtin/help.c | 8 +++++++-\n>  1 file changed, 7 insertions(+), 1 deletion(-)\n>\n> diff --git a/builtin/help.c b/builtin/help.c\n> index d1d7181..8969d3b 100644\n> --- a/builtin/help.c\n> +++ b/builtin/help.c\n> @@ -39,7 +39,7 @@ static int show_all = 0;\n>  static unsigned int colopts;\n>  static enum help_format help_format = HELP_FORMAT_NONE;\n>  static struct option builtin_help_options[] = {\n> -\tOPT_BOOLEAN('a', \"all\", &show_all, N_(\"print all available commands\")),\n> +\tOPT_BOOL('a', \"all\", &show_all, N_(\"print all available commands\")),\n>  \tOPT_SET_INT('m', \"man\", &help_format, N_(\"show man page\"), HELP_FORMAT_MAN),\n>  \tOPT_SET_INT('w', \"web\", &help_format, N_(\"show manual in web browser\"),\n>  \t\t\tHELP_FORMAT_WEB),\n> @@ -428,7 +428,13 @@ int cmd_help(int argc, const char **argv, const char *prefix)\n>  \t\tgit_config(git_help_config, NULL);\n>  \t\tprintf(_(\"usage: %s%s\"), _(git_usage_string), \"\\n\\n\");\n>  \t\tlist_commands(colopts, &main_cmds, &other_cmds);\n> +\t}\n> +\n> +\tif (show_all) {\n>  \t\tprintf(\"%s\\n\", _(git_more_info_string));\n> +\t\t/*\n> +\t\t* We're done. Ignore any remaining args\n> +\t\t*/\n>  \t\treturn 0;\n>  \t}\n"},{"id":"213015","messageId":"7vhajo76xh.fsf@alter.siamese.dyndns.org","threadId":"33360","inReplyTo":"7v62048qxm.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH V3 2/5] Help.c use OPT_BOOL and refactor logic","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-04-03T01:13:14Z","receivedAt":"2013-04-03T01:13:14Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> You are creating a gap in the output so that you can add some more\n> stuff in later patches, which is fine, but I do not think we call\n> that kind of change a \"refactor\" ;-).\n>\n> The change looks fine.\n\nI'll queue what I suggested on 'pu' for now.\n\nThanks.\n"},{"id":"213017","messageId":"CAPig+cRuz7m9CuGvhs5xDbH87+oPTt2XbchfW6EtFdTfN55rOg@mail.gmail.com","threadId":"33360","inReplyTo":"1364942392-576-6-git-send-email-philipoakley@iee.org","subject":"Re: [PATCH V3 5/5] Help doc: Include --guide option description","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2013-04-03T02:28:17Z","receivedAt":"2013-04-03T02:28:17Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Tue, Apr 2, 2013 at 6:39 PM, Philip Oakley <philipoakley@iee.org> wrote:\n>  OPTIONS\n>  -------\n>  -a::\n>  --all::\n>         Prints all the available commands on the standard output. This\n> -       option supersedes any other option.\n> +       option overides any given command or guide name.\n\ns/overides/overrides/\n\n> +\n> +-g::\n> +--guides::\n> +       Prints a list of useful guides on the standard output. This\n> +       option overides any given command or guide name.\n\nDitto: s/overides/overrides/\n"},{"id":"213018","messageId":"CAPig+cRv8P6jr-UaTFgo7H3JnNPDLGkW3R3B-+8_N+=+cL90_A@mail.gmail.com","threadId":"33360","inReplyTo":"1364942392-576-5-git-send-email-philipoakley@iee.org","subject":"Re: [PATCH V3 4/5] Help.c: add list_common_guides_help() function","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2013-04-03T02:30:32Z","receivedAt":"2013-04-03T02:30:32Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Tue, Apr 2, 2013 at 6:39 PM, Philip Oakley <philipoakley@iee.org> wrote:\n> Re-use list_common_cmds_help but simply change the array name.\n> Candidate for future refactoring to pass a pointer to the array.\n>\n> The common-guides.h list was generated with a simple variant of the\n> generate-cmdlist.sh and command-list.txt.\n>\n> Do not list User-manual and Everday Git which not follow the naming\n\ns/which not/which do not/\n\n> convention, nor gitrepository-layout which doesn't fit within the\n> name field size.\n"},{"id":"213072","messageId":"548AC0AF83DA42EA8C39C268693606AD@PhilipOakley","threadId":"33360","inReplyTo":"7vhajo76xh.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH V3 2/5] Help.c use OPT_BOOL and refactor logic","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":"2013-04-03T22:24:57Z","receivedAt":"2013-04-03T22:24:57Z","isPatch":true,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"Sent: Wednesday, April 03, 2013 2:13 AM\n> Junio C Hamano <gitster@pobox.com> writes:\n> \n>> You are creating a gap in the output so that you can add some more\n>> stuff in later patches, which is fine, but I do not think we call\n>> that kind of change a \"refactor\" ;-).\n>>\n>> The change looks fine.\n> \n> I'll queue what I suggested on 'pu' for now.\n\nIt looks good. I'm happy with your suggestions as queued.\n\nAcked-by: Philip Oakley <philipoakley@iee.org>\n\nLonger term I'd like to be able to show all the guides as a double -gg\noption, but this is a great start.\n\n> \n> Thanks.\n> \n> \n> -----\n"},{"id":"214056","messageId":"20130412135142.GA29454@ruderich.org","threadId":"33360","inReplyTo":"1364942392-576-5-git-send-email-philipoakley@iee.org","subject":"[PATCH] help: mark common_guides[] as translatable","fromName":"Simon Ruderich","fromEmail":"simon@ruderich.org","sentAt":"2013-04-12T13:51:42Z","receivedAt":"2013-04-12T13:51:42Z","isPatch":true,"sender":{"key":"simon@ruderich.org","avatar":"https://avatars.githubusercontent.com/u/390994?v=4"},"body":"Signed-off-by: Simon Ruderich <simon@ruderich.org>\n---\nOn Tue, Apr 02, 2013 at 11:39:51PM +0100, Philip Oakley wrote:\n> --- a/help.c\n> +++ b/help.c\n> @@ -240,6 +241,23 @@ void list_common_cmds_help(void)\n>  \t}\n>  }\n>\n> +void list_common_guides_help(void)\n> +{\n> +\tint i, longest = 0;\n> +\n> +\tfor (i = 0; i < ARRAY_SIZE(common_guides); i++) {\n> +\t\tif (longest < strlen(common_guides[i].name))\n> +\t\t\tlongest = strlen(common_guides[i].name);\n> +\t}\n> +\n> +\tputs(_(\"The common Git guides are:\\n\"));\n> +\tfor (i = 0; i < ARRAY_SIZE(common_guides); i++) {\n> +\t\tprintf(\"   %s   \", common_guides[i].name);\n> +\t\tmput_char(' ', longest - strlen(common_guides[i].name));\n> +\t\tputs(_(common_guides[i].help));\n\ncommon_guides[] is used here, but without N_() not picked up by\nxgettext when creating the pot file.\n\nRegards\nSimon\n\n builtin/help.c | 14 +++++++-------\n 1 file changed, 7 insertions(+), 7 deletions(-)\n\ndiff --git a/builtin/help.c b/builtin/help.c\nindex 034c36c..062957f 100644\n--- a/builtin/help.c\n+++ b/builtin/help.c\n@@ -419,13 +419,13 @@ static struct {\n \tconst char *name;\n \tconst char *help;\n } common_guides[] = {\n-\t{ \"attributes\", \"Defining attributes per path\" },\n-\t{ \"glossary\", \"A Git glossary\" },\n-\t{ \"ignore\", \"Specifies intentionally untracked files to ignore\" },\n-\t{ \"modules\", \"Defining submodule properties\" },\n-\t{ \"revisions\", \"Specifying revisions and ranges for Git\" },\n-\t{ \"tutorial\", \"A tutorial introduction to Git (for version 1.5.1 or newer)\" },\n-\t{ \"workflows\", \"An overview of recommended workflows with Git\"},\n+\t{ \"attributes\", N_(\"Defining attributes per path\") },\n+\t{ \"glossary\", N_(\"A Git glossary\") },\n+\t{ \"ignore\", N_(\"Specifies intentionally untracked files to ignore\") },\n+\t{ \"modules\", N_(\"Defining submodule properties\") },\n+\t{ \"revisions\", N_(\"Specifying revisions and ranges for Git\") },\n+\t{ \"tutorial\", N_(\"A tutorial introduction to Git (for version 1.5.1 or newer)\") },\n+\t{ \"workflows\", N_(\"An overview of recommended workflows with Git\") },\n };\n \n static void list_common_guides_help(void)\n-- \n1.8.2.481.g0d034d4\n\n-- \n+ privacy is necessary\n+ using gnupg http://gnupg.org\n+ public key id: 0x92FEFDB7E44C32F9\n"},{"id":"214073","messageId":"76E75C159EF54DD4A26051735FA370C8@PhilipOakley","threadId":"33360","inReplyTo":"20130412135142.GA29454@ruderich.org","subject":"Re: [PATCH] help: mark common_guides[] as translatable","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":"2013-04-12T16:16:30Z","receivedAt":"2013-04-12T16:16:30Z","isPatch":true,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"From: \"Simon Ruderich\" <simon@ruderich.org>\nSent: Friday, April 12, 2013 2:51 PM\n> Signed-off-by: Simon Ruderich <simon@ruderich.org>\n> ---\n> On Tue, Apr 02, 2013 at 11:39:51PM +0100, Philip Oakley wrote:\n>> --- a/help.c\n>> +++ b/help.c\n>> @@ -240,6 +241,23 @@ void list_common_cmds_help(void)\n>>  }\n>>  }\n>>\n>> +void list_common_guides_help(void)\n>> +{\n>> + int i, longest = 0;\n>> +\n>> + for (i = 0; i < ARRAY_SIZE(common_guides); i++) {\n>> + if (longest < strlen(common_guides[i].name))\n>> + longest = strlen(common_guides[i].name);\n>> + }\n>> +\n>> + puts(_(\"The common Git guides are:\\n\"));\n>> + for (i = 0; i < ARRAY_SIZE(common_guides); i++) {\n>> + printf(\"   %s   \", common_guides[i].name);\n>> + mput_char(' ', longest - strlen(common_guides[i].name));\n>> + puts(_(common_guides[i].help));\n>\n> common_guides[] is used here, but without N_() not picked up by\n> xgettext when creating the pot file.\n\nYes. I mucked that up when I hacked the generate-cmdlist.sh to create \nthis list.\n\nAcked-by: Philip Oakley <philipoakley@iee.org>\n\nAt some point it is on my TODO list to extend the guide list mechanism \nto all the community generated guides (option -gg) by extending the \ncommand-list.txt file and the shell script.\n\n>\n> Regards\n> Simon\n>\n> builtin/help.c | 14 +++++++-------\n> 1 file changed, 7 insertions(+), 7 deletions(-)\n>\n> diff --git a/builtin/help.c b/builtin/help.c\n> index 034c36c..062957f 100644\n> --- a/builtin/help.c\n> +++ b/builtin/help.c\n> @@ -419,13 +419,13 @@ static struct {\n>  const char *name;\n>  const char *help;\n> } common_guides[] = {\n> - { \"attributes\", \"Defining attributes per path\" },\n> - { \"glossary\", \"A Git glossary\" },\n> - { \"ignore\", \"Specifies intentionally untracked files to ignore\" },\n> - { \"modules\", \"Defining submodule properties\" },\n> - { \"revisions\", \"Specifying revisions and ranges for Git\" },\n> - { \"tutorial\", \"A tutorial introduction to Git (for version 1.5.1 or \n> newer)\" },\n> - { \"workflows\", \"An overview of recommended workflows with Git\"},\n> + { \"attributes\", N_(\"Defining attributes per path\") },\n> + { \"glossary\", N_(\"A Git glossary\") },\n> + { \"ignore\", N_(\"Specifies intentionally untracked files to \n> ignore\") },\n> + { \"modules\", N_(\"Defining submodule properties\") },\n> + { \"revisions\", N_(\"Specifying revisions and ranges for Git\") },\n> + { \"tutorial\", N_(\"A tutorial introduction to Git (for version 1.5.1 \n> or newer)\") },\n> + { \"workflows\", N_(\"An overview of recommended workflows with \n> Git\") },\n> };\n>\n> static void list_common_guides_help(void)\n> -- \n> 1.8.2.481.g0d034d4\n>\n> -- \n> + privacy is necessary\n> + using gnupg http://gnupg.org\n> + public key id: 0x92FEFDB7E44C32F9\n"}]}