Subject: Re: [PATCH] Documentation/git-stash.txt: Adjust SYNOPSIS command syntaxes

From: Jakub Narebski <[email-masked]>
Date: Sat, 02 Feb 2008 01:45:50 -0800 (PST)

Jari Aalto <[email-masked]> writes:

> * Fri 2008-02-01 Jakub Narebski <[email-masked]>
> * Message-Id: [email-masked]
> 
>>> he text should stand out as it it in environment,
>>> which do not render termcap or other terminal capabilities.
>>
>> Nevertheless it would be nice if our AsciiDoc configuration generated
>> italics or underline ...for manpage, and italics for HTML output for
>> placeholders, *in addition* to using angle parentheses (angle braces)
>> as delimites for placeholder parameters.
> 
> Sure, let's notify the asciidoc maintainer know about the wishes (CC'd)

Errr... I'm not sure if it is generic enough.  Although the POSIX/Susv
you have quoted. together with man(7) / manpage(5) pages I have quoted
seems to tell that it is so: POSIX/Susv talks about using angle
brackets to denote placeholders (to be substituted), man/manpage talks
about using italics/underline to denote placeholders.

So to say: I'm interested what AsciiDoc maintainers would say to that.
I have added asciidoc-discuss to Cc:, but please cull it (and the
asciidoc maintainer) from the Cc: list when replying.

>>> http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap12.html
>>>
>>> Here are the POSIX/Susv guidelines for the manual pages, I've marked the
>>> relevant points with **....**. We were both right: Angles mean required
>>> and grouping.
>>
>> Errr... as far as I understand angles means placeholders, i.e. user
>> supplied input. You can use "[<file>...]" for optional placeholder;
>> everything which is not inside brackets is required.
> 
> If you choose to use the "optional", then you are _required_ to fill in
> the mentioned item. The "[....]" is applied in your example as well. The
> angles always keep it's nature, which is a requirement:
> 
>     4. Frequently, names of parameters that _require_ substitution(...)
> 
>         <parameter name>

Excuse me, but item is "required" if it is not marked (by brackets, or
by listing it as one of alternate calling conventions in separate
lines) as "optional". So both in "cmd -A" and in "cmd <file>"
parameters '-A' (literal) and '<file>' (to be substituted by filename)
are required parameters, while both in "cmd [-A]" and in 
"cmd [<file>]" appropriate parameters are optional.

Angle brackets does not mean required parameters. Please read
carefully; they denote parameters which _require substitution_ (note
those _two_ words together), i.e. parameters that the user need to
replace with appropriate input.

>> It is used quite frequently in git manpages. Using parentheses to
>> delimit required alternate parts seems quite sensible.
>>
>>   'git-branch' (-m | -M) [<oldbranch>] <newbranch>
> 
> The change is small, but important. People look at the manual paged any
> will get the wrong impression on "the standard notation"
> 
>     'git-branch' {-m | -M} [<oldbranch>] <newbranch>
>                  =       =
>                  Change to use curlies

Perhaps. This I guess needs some discussion.

Nevertheless if / when we decide to change to this notation to delimit
parts of alternates / mutually exclusive parts, we would want to do
this in patch which changes only that, but changes it everywhere.

>> Note that in the POSIX/SUSV below parentheses / curly braces are not
>> mentioned.
> 
> True. The precedence of curlies has however been set long ago in
> software books and in other Unix manaul pages.

I have checked a bit of manual pages (in Linux), and only very few use
this convention. Do you have any statistics?

>>> -----------------------------------------------------------------------
>>> http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap01.html#tag_01_11
>>> 
>>> 12.1 Utility Argument Syntax
>>> http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap12.html#tag_12_01
>>> 
>>>     [...]
>>> 
>>>     4. Frequently, names of parameters that **require** substitution by
>>>     actual values are shown with embedded underscores. Alternatively,
>>>     parameters are shown as follows:
>>> 
>>>         <parameter name>
>>> 
>>>     The angle brackets are used for the symbolic grouping of a phrase
>>>     representing a single parameter and conforming applications shall
>>>     not include them in data submitted to the utility.
>>
>> This means that <param> denotes placeholder: parameter that requires
>> **subsititution** (this part should be emphasized!). Such parameter
>> might have multi-word name. Such parameter might be required, but
>> might be optional.
> 
> It's never optional. For optionality, there is specific notation.

Again: it is required if it is not optional. There is no notation for
required parts, except that they are not marked as optional. In the
"cmd <file>" it is not angle brackets around <file> that denotes that
this parameter is requires, it is lacks of "[" "]" brackets around
parameter that tells it.

> Everybody knows how to read these; what is required and what is not:
> 
>     command <arg> <arg>
>     command <arg> [<message>]
>     command <arg> [-lbc]
> 
> The <message> here is symbolic and not to be taken literally, whereas
> text that is not eclosed inside angles, "-lbc", is to be taken
> literally and interpreted by the rules of "set of options".

All true. And all what I wanted to tell.

>> Note that is natural that '[' and ']' also are limits of mutualy
>> exclusive parameters: "cmd [ A | B ]" means "cmd" or "cmd A" or "cmd B".
> 
> We are in all agreement on this one.

Good.
 
>>>     9. Ellipses ( "..." ) are used to denote that one or **more**
>>>     occurrences of an option or operand are allowed. When an option or
>>>     an operand followed by ellipses is enclosed in brackets, **zero** or
>>>     more options or operands can be specified.
>>> 
>>>         utility_name [-g option_argument]...[operand...]
>>
>> Note that one is not followed strictly, and one should take note of
>> that. For example to make sure that everybody knows that it is zero or
>> more one would use [<param>...], and to make use that it is one or
>> more one would use "<param> [<param>...]", just to be sure.
> 
> That's what it says. Outside of "[]" the ellipses mean (1+), indiside
> "[]", by rules of the brackets, it means (0+). I forgot to paste the
> two examples. Here:
> 
>     utility_name -f option_argument...[operand...]
>     utility_name [-g option_argument]...[operand...]

Ooops. Sorry. This time *I* haven't read this carefully enough.

-- 
Jakub Narebski
Poland
ShadeHawk on #git