git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ramsay Jones <ramsay@ramsayjones.plus.com>
To: "René Scharfe" <l.s.r@web.de>, "Jeff King" <peff@peff.net>,
	"Junio C Hamano" <gitster@pobox.com>
Cc: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCH 1/6] add, update-index: fix --chmod argument help
Date: Thu, 2 Aug 2018 21:59:44 +0100	[thread overview]
Message-ID: <4b6fa9ca-97ad-74e8-f252-cc62470f5946@ramsayjones.plus.com> (raw)
In-Reply-To: <2bc31a96-1d1a-3b71-59cc-47a3a2e29e16@web.de>



On 02/08/18 20:17, René Scharfe wrote:
> Don't translate the argument specification for --chmod; "+x" and "-x"
> are the literal strings that the commands accept.
> 
> Separate alternatives using a pipe character instead of a slash, for
> consistency.
> 
> Use the flag PARSE_OPT_LITERAL_ARGHELP to prevent parseopt from adding a
> pair of angular brackets around the argument help string, as that would
> wrongly indicate that users need to replace the literal strings with
> some kind of value.
> 
> Signed-off-by: Rene Scharfe <l.s.r@web.de>
> ---
>  builtin/add.c          | 4 +++-
>  builtin/update-index.c | 2 +-
>  2 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/builtin/add.c b/builtin/add.c
> index 8a155dd41e..84bfec9b73 100644
> --- a/builtin/add.c
> +++ b/builtin/add.c
> @@ -304,7 +304,9 @@ static struct option builtin_add_options[] = {
>  	OPT_BOOL( 0 , "refresh", &refresh_only, N_("don't add, only refresh the index")),
>  	OPT_BOOL( 0 , "ignore-errors", &ignore_add_errors, N_("just skip files which cannot be added because of errors")),
>  	OPT_BOOL( 0 , "ignore-missing", &ignore_missing, N_("check if - even missing - files are ignored in dry run")),
> -	OPT_STRING( 0 , "chmod", &chmod_arg, N_("(+/-)x"), N_("override the executable bit of the listed files")),
> +	{ OPTION_STRING, 0, "chmod", &chmod_arg, "(+|-)x",

Am I alone in thinking that "(+x|-x)" is more readable?

ATB,
Ramsay Jones

> +	  N_("override the executable bit of the listed files"),
> +	  PARSE_OPT_LITERAL_ARGHELP },
>  	OPT_HIDDEN_BOOL(0, "warn-embedded-repo", &warn_on_embedded_repo,
>  			N_("warn when adding an embedded repository")),
>  	OPT_END(),
> diff --git a/builtin/update-index.c b/builtin/update-index.c
> index a8709a26ec..7feda6e271 100644
> --- a/builtin/update-index.c
> +++ b/builtin/update-index.c
> @@ -971,7 +971,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
>  			PARSE_OPT_NOARG | /* disallow --cacheinfo=<mode> form */
>  			PARSE_OPT_NONEG | PARSE_OPT_LITERAL_ARGHELP,
>  			(parse_opt_cb *) cacheinfo_callback},
> -		{OPTION_CALLBACK, 0, "chmod", &set_executable_bit, N_("(+/-)x"),
> +		{OPTION_CALLBACK, 0, "chmod", &set_executable_bit, "(+|-)x",
>  			N_("override the executable bit of the listed files"),
>  			PARSE_OPT_NONEG | PARSE_OPT_LITERAL_ARGHELP,
>  			chmod_callback},
> 

  parent reply	other threads:[~2018-08-02 20:59 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-01 18:43 [PATCH] push: comment on a funny unbalanced option help Junio C Hamano
2018-08-01 20:46 ` Ævar Arnfjörð Bjarmason
2018-08-01 21:48   ` Junio C Hamano
2018-08-01 22:31     ` Ævar Arnfjörð Bjarmason
2018-08-02 12:16       ` René Scharfe
2018-08-02 14:21         ` Ævar Arnfjörð Bjarmason
2018-08-02 15:06           ` René Scharfe
2018-08-02 15:16             ` René Scharfe
2018-08-02 15:24           ` Junio C Hamano
2018-08-02 15:31         ` Junio C Hamano
2018-08-02 16:50           ` René Scharfe
2018-08-02 16:54           ` Jeff King
2018-08-02 18:46             ` René Scharfe
2018-08-02 19:17               ` [PATCH 1/6] add, update-index: fix --chmod argument help René Scharfe
2018-08-02 20:41                 ` Ævar Arnfjörð Bjarmason
2018-08-02 20:59                 ` Ramsay Jones [this message]
2018-08-02 21:17                   ` Junio C Hamano
2018-08-02 21:04                 ` Andrei Rybak
2018-08-02 21:16                   ` Junio C Hamano
2018-08-02 19:17               ` [PATCH 2/6] difftool: remove angular brackets from " René Scharfe
2018-08-02 19:17               ` [PATCH 3/6] pack-objects: specify --index-version argument help explicitly René Scharfe
2018-08-02 19:17               ` [PATCH 4/6] send-pack: specify --force-with-lease " René Scharfe
2018-08-02 19:18               ` [PATCH 5/6] shortlog: correct option help for -w René Scharfe
2018-08-02 19:18               ` [PATCH 6/6] parse-options: automatically infer PARSE_OPT_LITERAL_ARGHELP René Scharfe
2018-08-02 20:05                 ` Junio C Hamano
2018-08-03  8:13                 ` Kerry, Richard
2018-08-03 10:39                 ` Kerry, Richard
2018-08-02 20:01               ` [PATCH] push: comment on a funny unbalanced option help Junio C Hamano
2018-08-02 22:38                 ` René Scharfe
2018-08-03 15:29                   ` Junio C Hamano
2018-08-02 15:44     ` Re* " Junio C Hamano
2018-08-02 15:59       ` René Scharfe
2018-08-02 16:23         ` Junio C Hamano
2018-08-02 20:33           ` Ævar Arnfjörð Bjarmason
2018-08-02 20:36             ` Junio C Hamano
2018-08-03  4:42               ` René Scharfe
2018-08-03 15:30                 ` Junio C Hamano
2018-08-01 22:57 ` Jonathan Nieder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4b6fa9ca-97ad-74e8-f252-cc62470f5946@ramsayjones.plus.com \
    --to=ramsay@ramsayjones.plus.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=l.s.r@web.de \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).