git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 3/3] Documentation: make explicit that optional arguments must be stuck

From
Jeff King <peff@peff.net>
Date
Sep 18, 2015, 19:27 UTC
Message-ID
<20150918192718.GE11068@sigill.intra.peff.net>
In-Reply-To
<1442588510-7379-4-git-send-email-Matthieu.Moy@imag.fr>
On Fri, Sep 18, 2015 at 05:01:50PM +0200, Matthieu Moy wrote:
Show 7 quoted lines
> The behavior of command-line options with optional arguments is
> documented in gitcli(7), but it is easy for users to miss, and hard for
> the same user to understand why e.g. "git status -u no" does not work.
> 
> Document this explicitly in the documentation of each short option having
> an optional argument: they are the most error prone since there is no '='
> sign between the option and its argument.

I like this. Even though it is redundant, it is getting information to the place where users can see it, and I don't think it is so large as to obscure the rest of the content.

Show 11 quoted lines
> diff --git a/Documentation/git-am.txt b/Documentation/git-am.txt
> index dbea6e7..5f0082e 100644
> --- a/Documentation/git-am.txt
> +++ b/Documentation/git-am.txt
> @@ -141,7 +141,8 @@ default.   You can use `--no-utf8` to override this.
>  
>  -S[<keyid>]::
>  --gpg-sign[=<keyid>]::
> -	GPG-sign commits.
> +	GPG-sign commits. The `keyid` argument is optional; if
> +	specified, it must be stuck to the option without a space.

I think this wording is probably OK. At first I thought it was saying the wrong thing for the long form ("stuck without a space" would mean "--gpg-sign[keyid]"), but I think the syntax just above makes it pretty clear.

Show 13 quoted lines
> diff --git a/Documentation/git-status.txt b/Documentation/git-status.txt
> index 335f312..e1e8f57 100644
> --- a/Documentation/git-status.txt
> +++ b/Documentation/git-status.txt
> @@ -53,8 +53,9 @@ OPTIONS
>  --untracked-files[=<mode>]::
>  	Show untracked files.
>  +
> -The mode parameter is optional (defaults to 'all'), and is used to
> -specify the handling of untracked files.
> +The mode parameter is used to specify the handling of untracked files.
> +It is optional: it defaults to 'all', and if specified, it must be
> +stuck to the option (e.g. `-uno`, but not `-u no`).
I think this rearrangement makes the meaning much more clear overall.
-Peff
Previous: Matthieu MoyNext: Matthieu Moy
Message 11 of 16 in “git status -u is mildly astonishing”
  1. Alastair McGowan-DouglasSep 17, 2015
  2. Matthieu MoySep 17, 2015
  3. Jeff KingSep 17, 2015
  4. Matthieu MoySep 18, 2015
  5. 0/3 Clarify the documentation of options with optional argumentsMatthieu Moy, Sep 18, 2015
  6. 1/3 Documentation: use 'keyid' consistantly, not 'key-id'Matthieu Moy, Sep 18, 2015
  7. Matthieu MoySep 18, 2015
  8. Jeff KingSep 18, 2015
  9. 2/3 Documentation/grep: fix documentation of -OMatthieu Moy, Sep 18, 2015
  10. 3/3 Documentation: make explicit that optional arguments must be stuckMatthieu Moy, Sep 18, 2015
  11. Jeff KingSep 18, 2015
  12. 0/3 Clarify the documentation of options with optional argumentsMatthieu Moy, Sep 19, 2015
  13. 1/3 Documentation: use 'keyid' consistently, not 'key-id'Matthieu Moy, Sep 19, 2015
  14. 2/3 Documentation/grep: fix documentation of -OMatthieu Moy, Sep 19, 2015
  15. 3/3 Documentation: explain optional arguments betterMatthieu Moy, Sep 19, 2015
  16. Jeff KingSep 19, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.