Skip to contentSkip to conversation

man-pages and usage() howto

DISCUSSION Karel Zak 3 participants 15 messages Aug 15, 2011 – Aug 23, 2011 Util-Linux package

lore
Share & tools
lore

Karel Zak

author maintainer
#0 lore raw

Hi,

Sami is already working on some howtos, what we need is some consensus about a way how describe options.

My suggestion:

* argument required:

   -o, --option FILE    # usage()
   -o, --option file    # man page

* optional argument:

   -o, --option[=FILE]  # usage()
   -o, --option[=file]  # man page

* synopsis

- without individual options, bad example:

command [-o offset] [--sizelimit size] [-p pfd] [-r] file

- [options] is better:

command [options] file

- use more synopsis lines if the command supports more separated modes.

command --add file
command --del file

(use common sense! ... if there is too many modes, then use [options])

The options specific to the mode are allowed in the synopsis or in the man page should be per-mode section with description about the options.

* common options:

   -V, --version
   -h, --help

* suggestions:

   -a, --all
   -o, --output <list>
   -r, --raw
   -f, --force
   -b, --bytes   (don't print SIZE in human readable format)

* We also need any consensus about groff formatting, the ideal solution would be add any Documentation/example.man

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
#1 lore raw
Quoted 2 lines · Karel Zak

Sami is already working on some howtos, what we need is some consensus about a way how describe options.

What I wrote about various things can be found from github. I'd say that so far the Documentation directory patch set is a proposal, which can and should change.

https://github.com/kerolasa/lelux-utiliteetit/blob/docs-dir/Documentation/h=
owto-usage-function.txt

Quoted 6 lines

My suggestion:

=A0* argument required:

=A0 -o, --option FILE =A0 =A0# usage()
=A0 -o, --option file =A0 =A0# man page

I used GNU notation which has 'unnecessary' equals sign.

-o, --option=3DFILE

The only reason I can think of why the equal sign is there is visual similarity with optional argument...

Quoted 4 lines

=A0* optional argument:

=A0 -o, --option[=3DFILE] =A0# usage()
=A0 -o, --option[=3Dfile] =A0# man page

...because with optional arguments one must use =3D and that make the [=3DFILE] notation correct. For example see the output of the following.

lscpu -p=3DCPU
lscpu -p CPU

I also acknowledge the fact that no-one will ever use equals sign when giving required argument. The practise of dropping it is a rational reason not to specify it to usage() or man. I would say this is a question of choosing a convention in between visual symmetry or actual habits of people. IMHO the visual unity is better.

Quoted 9 lines

=A0* synopsis

=A0 - without individual options, bad example:

=A0 =A0 =A0 =A0command [-o offset] [--sizelimit size] [-p pfd] [-r] file

=A0 - [options] is better:

=A0 =A0 =A0 =A0command [options] file

I agree.

Quoted 1 line

=A0 - use more synopsis lines if the command supports more separated mode=

s.

Quoted 5 lines

=A0 =A0 =A0 command --add file
=A0 =A0 =A0 command --del file

=A0 =A0 (use common sense! ... if there is too many modes, then use [opti=

ons])

Quoted 4 lines

=A0 =A0 The options specific to the mode are allowed in the synopsis or =A0 =A0 in the man page should be per-mode section with description about =A0 =A0 the options.

I did not think multiple modes when I wrote howto-usage. Manual page of man seems to be good example of extensive synopsis. If I've not gone crazy the point of modes seems to point out that some options, arguments, etc mean outcome of an execution is fundamentally different, for example

man -k basename
man -w basename

So the howto should tell how do you know you are dealing with fundamental difference of outcome, which requires multiple synopsis lines. Obvious trap seems to be such hermeneutic circle that no-one understands what the howto tries to say. Rigour rejection until the text is good is needed.

Quoted 4 lines

=A0* common options:

=A0 -V, --version
=A0 -h, --help

I would call these two options explicitly reserved. The -?' should not be a synonym of -h' but an invalid option in common case.

Quoted 7 lines

=A0* suggestions:

=A0 -a, --all
=A0 -o, --output <list>
=A0 -r, --raw
=A0 -f, --force
=A0 -b, --bytes =A0 (don't print SIZE in human readable format)

Eric S. Raymond's The Art of Unix Programming is proposing something simila= r.

http://www.faqs.org/docs/artu/ch10s05.html

In nutshell one should think carefully before using a short option against it's well known other use.

I can think immediately an annoyance in the rule of well known. Well known to who, in what context and is it even relevant? Could good go around for this problem is to give a concrete list of short & long options which in context of this package are well-known, and nothing else is. That will also allow several well known definitions to a single short option, which I like. For example

-s, --size
-s, --silent (prefer -q)
-q, --quiet

Assuming this approach sounds good the question is shall we write shortest or longest possible list of well known options list? I'm in favour of short list because it requires less maintenance.

Quoted 2 lines

=A0* We also need any consensus about groff formatting, the ideal =A0 solution would be add any Documentation/example.man

Here's my proposal, which without doubt needs honing.

https://github.com/kerolasa/lelux-utiliteetit/blob/docs-dir/Documentation/h=
owto-man-page.txt

--=20
=A0=A0 Sami Kerola
=A0=A0 http://www.iki.fi/kerolasa/

#2 lore raw
Quoted 9 lines · Sami Kerola
Quoted 4 lines · Karel Zak

=C2=A0* argument required:

=C2=A0 -o, --option FILE =C2=A0 =C2=A0# usage()
=C2=A0 -o, --option file =C2=A0 =C2=A0# man page

=20
I used GNU notation which has 'unnecessary' equals sign. =20
-o, --option=3DFILE

The full GNU style seems to be this (for example in 'man grep'):

  -o FILE, --option=3DFILE

Since the util-linux man pages don't put the argument after the short version of the option, the ' -o, --option FILE' variant would be for me the logical condensed intersection. Also, why give the impression that the equals sign is needed when it is not?
=20

Quoted 8 lines

The only reason I can think of why the equal sign is there is visual similarity with optional argument... [...]
=20
I also acknowledge the fact that no-one will ever use equals sign when giving required argument. The practise of dropping it is a rational reason not to specify it to usage() or man. I would say this is a question of choosing a convention in between visual symmetry or actual habits of people. IMHO the visual unity is better.

IMHO visual contrast is better. When my fleeting glance sees an equals sign OR square brackets, I know the argument is optional; when it does not see an equals sign OR does not see square brackets, the argument is required. Redundancy is good.

Quoted 1 line
Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0command [options] file

If in the usage() help text the arguments of options are written in uppercase, wouldn't it be more consistent to then also write the arguments of the command itself in uppercase (as for example 'man -h' and 'grep --help' do)?

command [OPTIONS] FILE

(Also, to be fully correct, it would have to say "[OPTION...]" instead, but I will let that go.)

About the other things I have not yet an opinion.

Regards,

Benno

--=20
http://www.fastmail.fm - Access all of your messages and folders
wherever you are

author maintainer
#3 lore raw
Quoted 4 lines · Benno Schulenberg
Quoted 1 line
Quoted 1 line

       command [options] file

If in the usage() help text the arguments of options are written in uppercase, wouldn't it be more consistent to then also write the

It depends, Semi's version is uppercase, but my (findmnt, blkid, lsblk, ...) is <lowercase> :-)

Quoted 1 line

About the other things I have not yet an opinion.

I made the decision, --option <argument>. We can play with it little bit more in the next release. Now I'd like to release it...

It would be also nice to sync man pages with usage() format. Note that man pages changes are acceptable for -rc2.

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
#4 lore raw
Quoted 5 lines · Karel Zak
Quoted 1 line · Sami Kerola

I used GNU notation which has 'unnecessary' equals sign.

[...]

Quoted 1 line

IMHO the visual unity is better.

Quoted 7 lines

I understand, but I'm not sure about readability... well, I have asked my colleagues and the winer is:

   --date <time>

the important is visual difference between static option name and variable option argument.

Diamond brackets make visual difference to look quite nice. I do like this.

-n, --no-argument this option requires no_argument
-o, --optional[=3Darg] this option has optional_argument -r, --required <arg> this option requires required_argument

Quoted 2 lines

You can hate me, but we need any decision. I'll cleanup the usage() strings now.

Hate? No way! Decision after fair discussion is something I greatly value, even I could have had heretic wrong opinions during conversation. The hate is reserved for unjust decisions.

Quoted 9 lines
Quoted 5 lines

So the howto should tell how do you know you are dealing with fundamental difference of outcome, which requires multiple synopsis lines. Obvious trap seems to be such hermeneutic circle that no-one understands what the howto tries to say. Rigour rejection until the text is good is needed.

I think we have to use common sense here. Sometimes multiple synopsis lines makes sense (losetup -h ?). There is not necessary any strict rule.

I likely made that sound over complicated. I know what I want to mean, the next thing is to write it understandable way down. Key word is not write but understandable, which makes this difficult if anything.

Quoted 11 lines

I'm just working on Benno's patches and I found that we need some explicitly defined rules for usage():

- "Usage:" and "Options:" use separate lines and strings, before

      the sections has to be empty line:

      fputs(_("\nUsage:\n"), out);
      ...
      fputs(_("\nOptions:\n"), out);

    (so this two string will be translated only once)

How putting to c.h the following?

#define USAGE_HEADER _("\nUsage:\n")
#define USAGE_OPTIONS _("\nOptions:\n") #define USAGE_SHORT_TAIL _("\n")
#define USAGE_MAN_TAIL _("For more details see %s.")

Rest should be obvious.

Having also definition for OPTION_HELP && OPTION_VERSION would be good.

Quoted 9 lines

- all lines with options and synopsis are prefixed

    by ***one*** space (0x40):

      fputs(_("\nUsage:\n"), out);
      fprintf(out,
            _(" %s [options]\n"), something);

      fputs(_("\nOptions:\n"), out);
      fputs(_(" -b, --bar            this is bar\n");

Assuming we end up using definitions this does not have to be that specific.

Quoted 5 lines

- in the code all strings with options have to start at the same

    position. It means:

    fprintf(out, _(" -x[=3D<foo>]   default foo is %s"), x);
    fputs(       _(" -y         some text"), out);

I agree.

Quoted 5 lines

- the first and last usage() output line is empty

- the last line does not have to be empty if there is additional info about a man page "For more details see foo(1)."

Yes, and the definitions...

Quoted 1 line

- use manageable chunks for the usage strings (one or few lines)

Sound reasonable, I'll add this to howto.

Quoted 2 lines

- separator between short and long options is comma and one space:

    " -x, --long-x "

I agree, and adding to howto is needed.

Quoted 9 lines · Karel Zak
Quoted 5 lines · Benno Schulenberg
Quoted 1 line

command [options] file

If in the usage() help text the arguments of options are written in uppercase, wouldn't it be more consistent to then also write the

It depends, Semi's version is uppercase, but my (findmnt, blkid, lsblk, ...) is <lowercase> :-)

I made my own office vote. The seasoned command line guys, by clear margin, voted for lower case. Explanation why I wrote originally with upper case was a copy how GNU does it, but as the results show people do not like it.

Quoted 8 lines
Quoted 1 line

About the other things I have not yet an opinion.

I made the decision, --option <argument>. We can play with it little bit more in the next release. Now I'd like to release it...

It would be also nice to sync man pages with usage() format. Note that man pages changes are acceptable for -rc2.

Sounds that the version 2.21 will have hefty amount of usage(), man page and documentation changes. I hope all is done by Jan 2012.

--=20
=A0=A0 Sami Kerola
=A0=A0 http://www.iki.fi/kerolasa/

#5 lore raw
Quoted 9 lines · Sami Kerola
Quoted 5 lines · Karel Zak
   --date <time>

the important is visual difference between static option name and variable option argument.

Diamond brackets make visual difference to look quite nice. I do like this.

Yes, it does look better than all uppercase, so I'll accept. (That I stuck to uppercase is because it wastes less space, and with just 80 characters width this sometimes matters, plus it seemed widespread tradition.)

Quoted 3 lines
 -n, --no-argument     this option requires no_argument
 -o, --optional[=arg]  this option has optional_argument
 -r, --required <arg>  this option requires required_argument

The middle one would need the pointy brackets, too, no?

-o, --optional[=<arg>] this option has optional_argument

Quoted 11 lines
Quoted 11 lines

I'm just working on Benno's patches and I found that we need some explicitly defined rules for usage():

- "Usage:" and "Options:" use separate lines and strings, before

      the sections has to be empty line:

      fputs(_("\nUsage:\n"), out);
      ...
      fputs(_("\nOptions:\n"), out);

    (so this two string will be translated only once)

As a translator I do not quite like the separation of the "\nUsage:\n" string from the actual synopsis -- it is good to have some context in the string. But I'll accept. The initial space of the actual synopsis strings will eventually let translators understand what they are.

Quoted 6 lines

How putting to c.h the following?

#define USAGE_HEADER _("\nUsage:\n")
#define USAGE_OPTIONS _("\nOptions:\n") #define USAGE_SHORT_TAIL _("\n")
#define USAGE_MAN_TAIL _("For more details see %s.")

Especially the latter would be nice: at the moment there are many such lines with just a differing final word.

Quoted 2 lines

Having also definition for OPTION_HELP && OPTION_VERSION would be good.

That won't work -- the amount of indentation for the option description is not the same for all utilities. And to make it the same for all would create ugly and unneeded wide open text spaces for some tools.

Quoted 3 lines
Quoted 3 lines

I made the decision, --option <argument>. [...]

It would be also nice to sync man pages with usage() format.

Do you mean that you want to use "--option <argument>" also in the man pages, Karel? Or do we stick there to italics for arguments? (Which translates to underlining on terminals.)

Regards,

Benno

Signature · 1 line
http://www.fastmail.fm - Email service worth paying for. Try it for free
#6 lore raw
Quoted 10 lines · Benno Schulenberg
Quoted 5 lines · Sami Kerola
Quoted 1 line · Karel Zak
 -n, --no-argument     this option requires no_argument
 -o, --optional[=arg]  this option has optional_argument
 -r, --required <arg>  this option requires required_argument

The middle one would need the pointy brackets, too, no?

-o, --optional[=<arg>] this option has optional_argument

You are right. Fixed to howto-usage-function.txt

Quoted 10 lines
Quoted 6 lines

How putting to c.h the following?

#define USAGE_HEADER _("\nUsage:\n")
#define USAGE_OPTIONS _("\nOptions:\n") #define USAGE_SHORT_TAIL _("\n")
#define USAGE_MAN_TAIL _("For more details see %s.")

Especially the latter would be nice: at the moment there are many such lines with just a differing final word.

Quoted 6 lines
Quoted 2 lines

Having also definition for OPTION_HELP && OPTION_VERSION would be good.

That won't work -- the amount of indentation for the option description is not the same for all utilities. And to make it the same for all would create ugly and unneeded wide open text spaces for some tools.

To me it does not sound a big deal if --help and --version description begins from different indent than rest of lines. I wrote example output that way, so that you can judge how that will look.

https://github.com/kerolasa/lelux-utiliteetit/blob/docs-dir/Documentation/howto-usage-function.txt

I do not understand why it would be sensible to ask translation teams to make tens of versions near same help & usage strings while these string could simply be a bit ugly.

Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

I made the decision, --option <argument>. [...]

It would be also nice to sync man pages with usage() format.

Do you mean that you want to use "--option <argument>" also in the man pages, Karel? Or do we stick there to italics for arguments? (Which translates to underlining on terminals.)

What ever was meant the howto is incomplete.

https://github.com/kerolasa/lelux-utiliteetit/blob/docs-dir/Documentation/howto-man-page.txt

IMHO the following looks quite ok, and not too different to usage().

.TP
\fB\-n\fR, \fB\-\-no\-argument\fR
This option does not use argument.
.TP
\fB\-o\fR, \fB\-\-optional\fR[=<\fIarg\fR>]
This option uses optional argument.
.TP
\fB\-r\fR, \fB\-\-required\fR <\fIarg\fR>
This option requires an argument.

Comments?

Signature · 2 lines
   Sami Kerola
   http://www.iki.fi/kerolasa/
author maintainer
#8 lore raw
In reply to Sami Kerola
Quoted 8 lines · Sami Kerola
Quoted 7 lines · Benno Schulenberg
Quoted 2 lines · Sami Kerola
Quoted 1 line · Karel Zak

It would be also nice to sync man pages with usage() format.

Do you mean that you want to use "--option <argument>" also in the man pages, Karel? Or do we stick there to italics for arguments? (Which translates to underlining on terminals.)

I mean that we need to use the lowercase for the arguments in usage() as well as in man pages.

Quoted 13 lines

IMHO the following looks quite ok, and not too different to usage().

.TP
\fB\-n\fR, \fB\-\-no\-argument\fR
This option does not use argument.
.TP
\fB\-o\fR, \fB\-\-optional\fR[=<\fIarg\fR>]
This option uses optional argument.
.TP
\fB\-r\fR, \fB\-\-required\fR <\fIarg\fR>
This option requires an argument.

Quoted 1 line

Comments?

I have no strong opinion about it. Benno is probably right that italics for the arguments is enough.

We already use option arguments without diamond brackets in our man pages, so let's continue with this convention to minimize number of changes in the man pages ;-)

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
#9 lore raw
Quoted 13 lines · Karel Zak
Quoted 12 lines

IMHO the following looks quite ok, and not too different to usage().

.TP
\fB\-n\fR, \fB\-\-no\-argument\fR
This option does not use argument.
.TP
\fB\-o\fR, \fB\-\-optional\fR[=3D<\fIarg\fR>]
This option uses optional argument.
.TP
\fB\-r\fR, \fB\-\-required\fR <\fIarg\fR>
This option requires an argument.

Quoted 6 lines

=A0I have no strong opinion about it. Benno is probably right that =A0italics for the arguments is enough.

=A0We already use option arguments without diamond brackets in our man =A0pages, so let's continue with this convention to minimize number of =A0changes in the man pages ;-)

The howto-man-page.txt now has arguments underlined without diamond brackets. Optional argument has square brackets surrounding it.

Is the patch set ready now? Have a look, and in absence of comments merge might be reasonable thing to do after few days.

https://github.com/kerolasa/lelux-utiliteetit/tree/docs-dir/Documentation

--=20
=A0=A0 Sami Kerola
=A0=A0 http://www.iki.fi/kerolasa/

#10 lore raw
In reply to Sami Kerola
Quoted 5 lines · Sami Kerola
Quoted 4 lines · Benno Schulenberg
Quoted 2 lines · Sami Kerola

Having also definition for OPTION_HELP && OPTION_VERSION would be good.

Quoted 8 lines
Quoted 3 lines

That won't work -- the amount of indentation for the option description is not the same for all utilities. And to make it the same for all would create ugly and unneeded wide open text spaces for some tools.

To me it does not sound a big deal if --help and --version description begins from different indent than rest of lines. I wrote example output that way, so that you can judge how that will look.

When --help and --version are always the last two options of the usage help text, a differing indentation is acceptable. But if --help is ordered alphabetically, it will look broken.

Quoted 2 lines

\fB\-o\fR, \fB\-\-optional\fR[=<\fIarg\fR>]
This option uses optional argument.

As Karel said, the majority convention now is to not use pointy brackets for arguments in man pages. The italics/underlining is enough to make them stand out.

I would also suggest to not use "arg" but the full word "argument", so as to encourage writers to not unnecessarily abbreviate the argument name, to use for example "seconds" and not "secs", use "number" and not "num".

A thing about the formatting: why us \fB and \fR and \fB and \fR? Why not use the macro .BR at the start of the line instead? (I do not understand your comment about some macros not being visually different from plain .B or .I.)

Another thing: the man page formatter itself puts a double space after a period when in the man page source the next sentence begins on a new line. So when in the source a new sentence begins somewhere midline, it should use a double space before its initial letter.

Quoted 4 lines

From your usage howto:
-n, --no-argument option requires no_argument -o, --optional[=<arg>] option has optional_argument -r, --required <arg> option requires required_argument

Why the underscores? I would suggest the following:

  -n, --no-argument       option takes no argument
  -o, --optional[=<arg>]  option takes optional argument
  -r, --required <arg>    option requires an argument

(As in a usage text space is limited, abbreviations are okay.)

Regards,

Benno

Signature · 1 line
http://www.fastmail.fm - Access your email from home and the web
#11 lore raw

On Mon, Aug 22, 2011 at 22:38, Benno Schulenberg <[email protected]> w= rote:

Quoted 9 lines · Sami Kerola
Quoted 4 lines

To me it does not sound a big deal if --help and --version description begins from different indent than rest of lines. I wrote example output that way, so that you can judge how that will look.

When --help and --version are always the last two options of the usage help text, a differing indentation is acceptable. =A0But if --help is ordered alphabetically, it will look broken.

True, and that's why I wrote they should be last entries.

Quoted 6 lines
Quoted 2 lines

\fB\-o\fR, \fB\-\-optional\fR[=3D<\fIarg\fR>]
This option uses optional argument.

As Karel said, the majority convention now is to not use pointy brackets for arguments in man pages. =A0The italics/underlining is enough to make them stand out.

I guess you did not read from git the section.

.SH OPTIONS
.TP
\fB\-n\fR, \fB\-\-no\-argument\fR
This option does not use argument.
.TP
\fB\-o\fR, \fB\-\-optional\fR [\fIarg\fR] Tell in description an
.I arg
is optional, and what happens when is or is not given. .TP
\fB\-r\fR, \fB\-\-required\fR \fIarg\fR
Tell in description option
.I arg
is required.

As you can see no diamond brackets there.

Quoted 3 lines

I would also suggest to not use "arg" but the full word "argument", so as to encourage writers to not unnecessarily abbreviate the argument name, to use for example "seconds" and not "secs", use "number" and not "num".

Good point. I will fix that when I'm at home again.

Quoted 2 lines

A thing about the formatting: why us \fB and \fR and \fB and \fR? Why not use the macro .BR at the start of the line instead?

No matter how I tried to use various .B, .BR

Quoted 2 lines

(I do not understand your comment about some macros not being visually different from plain .B or .I.)

Either my term, groff or pager is/are broken, or I have wooden eyes or the different highlights do not stand out, see yourself:

http://ut3.org/~kerolasa/groff-highlight.png

What I tried to say; Do not get fooled that different macros will look different so that you can refer visually in between different text elements. For example in the screen shot on top the required argument has same appearance when it is next to switch & in text. I think that sort of consistency in style makes things more understandable.

Quoted 4 lines

Another thing: the man page formatter itself puts a double space after a period when in the man page source the next sentence begins on a new line. =A0So when in the source a new sentence begins somewhere midline, it should use a double space before its initial letter.

Are you sure it does that? See the screenshot notes section third paragraph line two, words `macros. See' has only single space in between them. Even there would be two spaces I do not agree that groff input writer should imitate output. It should be enough that words and sentences are white space separated, groff will take care the rest.

Quoted 5 lines

From your usage howto:

Quoted 3 lines

=A0-n, --no-argument option requires no_argument =A0-o, --optional[=3D<arg>] option has optional_argument =A0-r, --required <arg> option requires required_argument

Quoted 7 lines

Why the underscores? =A0I would suggest the following:

=A0-n, --no-argument =A0 =A0 =A0 option takes no argument =A0-o, --optional[=3D<arg>] =A0option takes optional argument =A0-r, --required <arg> =A0 =A0option requires an argument

(As in a usage text space is limited, abbreviations are okay.)

The weird underscores are used in option structure. Now when you mention that I think having such unexplained reference is not good. I'll write the description using ordinary text.

--=20
=A0=A0 Sami Kerola
=A0=A0 http://www.iki.fi/kerolasa/

#12 lore raw
Quoted 4 lines · Sami Kerola
Quoted 2 lines · Benno Schulenberg

(I do not understand your comment about some macros not being visually different from plain .B or .I.)

Quoted 8 lines

Either my term, groff or pager is/are broken, or I have wooden eyes or the different highlights do not stand out, see yourself:

http://ut3.org/~kerolasa/groff-highlight.png

What I tried to say; Do not get fooled that different macros will look different so that you can refer visually in between different text elements.

Hmm, maybe you misunderstand what for example the .BI macro does? It does not mean "bold _plus_ italic" but "alternate bold and italic". And it does that perfectly. See for example the attached example file.

Quoted 6 lines
Quoted 4 lines

Another thing: the man page formatter itself puts a double space after a period when in the man page source the next sentence begins on a new line.  So when in the source a new sentence begins somewhere midline, it should use a double space before its initial letter.

Are you sure it does that?

Yes, it does that here, on Ubuntu Lucid 10.10, with man 2.5.7.

Quoted 3 lines

See the screenshot notes section third
paragraph line two, words `macros. See' has only single space in between them.

Yes, but in the source it says "appropriate groff macros. See" on a single line. When you put the "See" on a line by itself, you wil see two spaces appear before it. See the attached example file.

Quoted 3 lines

Even there would be two spaces I do not agree that groff input writer should imitate output. It should be enough that words and sentences are white space separated, groff will take care the rest.

Well, being a doublespacer myself, I notice it when some sentences are single-spaced and others double; it irks. But never mind.

Regards,

Benno

Signature · 1 line
http://www.fastmail.fm - A fast, anti-spam email service.
#13 lore raw

On Tue, Aug 23, 2011 at 20:55, Benno Schulenberg <[email protected]> w= rote:

Quoted 9 lines · Sami Kerola
Quoted 1 line

On Mon, Aug 22, 2011 at 22:38, Benno Schulenberg <[email protected]=

Quoted 6 lines · wrote:
Quoted 2 lines

(I do not understand your comment about some macros not being visually different from plain .B or .I.)

Either my term, groff or pager is/are broken, or I have wooden eyes or the different highlights do not stand out, see yourself:

Quoted 8 lines
Quoted 5 lines

http://ut3.org/~kerolasa/groff-highlight.png

What I tried to say; Do not get fooled that different macros will look different so that you can refer visually in between different text elements.

Hmm, maybe you misunderstand what for example the .BI macro does? It does not mean "bold _plus_ italic" but "alternate bold and italic". =

=A0And it

Quoted 1 line

does that perfectly. =A0See for example the attached example file.

Indeed I have. Thank you clarifying that, and as obvious the strange (wrong) instruction in howto-man-page.txt is gone.

Quoted 1 line
Quoted 1 line
Quoted 1 line

Another thing: the man page formatter itself puts a double space after=

a

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

period when in the man page source the next sentence begins on a new line. =A0So when in the source a new sentence begins somewhere midline=

,

Quoted 11 lines
Quoted 3 lines
Quoted 1 line

it should use a double space before its initial letter.

Are you sure it does that?

Yes, it does that here, on Ubuntu Lucid 10.10, with man 2.5.7.

Quoted 3 lines

See the screenshot notes section third
paragraph line two, words `macros. See' has only single space in between them.

Yes, but in the source it says "appropriate groff macros. See" on a singl=

e

Quoted 1 line

line. =A0When you put the "See" on a line by itself, you wil see two spac=

es

Quoted 1 line

appear before it. =A0See the attached example file.

I'm quite near to say groff is a stupid program. Well, it seems that the instructions should indeed tell to use french spacing e.g. two spaces after a dot. After all it would be even more ridiculous to ask people to use dot only at middle of line so that groff will never add two spaces.

Quoted 6 lines
Quoted 3 lines

Even there would be two spaces I do not agree that groff input writer should imitate output. It should be enough that words and sentences are white space separated, groff will take care the rest.

Well, being a doublespacer myself, I notice it when some sentences are single-spaced and others double; it irks. =A0But never mind.

Quite the opposite, I did not know I where talking. Thanks again pointing out how wrong I where.

p.s. The usage() option thing is fixed as well.

--=20
=A0=A0 Sami Kerola
=A0=A0 http://www.iki.fi/kerolasa/

author maintainer
#14 lore raw
In reply to Sami Kerola
Quoted 7 lines · Sami Kerola
Quoted 2 lines · Karel Zak

Sami is already working on some howtos, what we need is some consensus about a way how describe options.

What I wrote about various things can be found from github. I'd say that so far the Documentation directory patch set is a proposal, which can and should change.

Yep, I think we can make it "perfect" in your githup repository before we merge it upstream ;-)

Quoted 1 line

I used GNU notation which has 'unnecessary' equals sign.

[...]

Quoted 1 line

IMHO the visual unity is better.

I understand, but I'm not sure about readability... well, I have asked my colleagues and the winer is:

    --date <time>

the important is visual difference between static option name and variable option argument.

You can hate me, but we need any decision. I'll cleanup the usage() strings now.

Quoted 5 lines

So the howto should tell how do you know you are dealing with fundamental difference of outcome, which requires multiple synopsis lines. Obvious trap seems to be such hermeneutic circle that no-one understands what the howto tries to say. Rigour rejection until the text is good is needed.

I think we have to use common sense here. Sometimes multiple synopsis lines makes sense (losetup -h ?). There is not necessary any strict rule.

[...]

Quoted 3 lines

Assuming this approach sounds good the question is shall we write shortest or longest possible list of well known options list? I'm in favour of short list because it requires less maintenance.

Sure, I agree.

I'm just working on Benno's patches and I found that we need some explicitly defined rules for usage():

- "Usage:" and "Options:" use separate lines and strings, before the sections has to be empty line:

fputs(_("\nUsage:\n"), out);
...
fputs(_("\nOptions:\n"), out);

(so this two string will be translated only once)

- all lines with options and synopsis are prefixed

     by ***one*** space (0x40):

       fputs(_("\nUsage:\n"), out);
       fprintf(out,
             _(" %s [options]\n"), something);

       fputs(_("\nOptions:\n"), out);
       fputs(_(" -b, --bar            this is bar\n");

- in the code all strings with options have to start at the same

     position. It means:

     fprintf(out, _(" -x[=<foo>]   default foo is %s"), x);
     fputs(       _(" -y         some text"), out);

- the first and last usage() output line is empty

- the last line does not have to be empty if there is additional info about a man page "For more details see foo(1)."

- use manageable chunks for the usage strings (one or few lines)

- separator between short and long options is comma and one space:

     " -x, --long-x "

Comments?

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com