From: Karel Zak <kzak@redhat.com>
To: kerolasa@gmail.com
Cc: Benno Schulenberg <bensberg@justemail.net>,
util-linux <util-linux@vger.kernel.org>
Subject: Re: man-pages and usage() howto
Date: Tue, 16 Aug 2011 12:39:37 +0200 [thread overview]
Message-ID: <20110816103937.GH1843@nb.net.home> (raw)
In-Reply-To: <CAG27Bk0LpsVdCJhvOAstC_OpckzfBB05kcZcN_ByF_i_JQU6SQ@mail.gmail.com>
On Mon, Aug 15, 2011 at 09:12:16PM +0200, Sami Kerola wrote:
> On Mon, Aug 15, 2011 at 16:19, Karel Zak <kzak@redhat.com> wrote:
> > 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 ;-)
> I used GNU notation which has 'unnecessary' equals sign.
[...]
> 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.
> 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.
[...]
> 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?
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
prev parent reply other threads:[~2011-08-16 10:39 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-15 14:19 man-pages and usage() howto Karel Zak
2011-08-15 19:12 ` Sami Kerola
2011-08-16 9:03 ` Benno Schulenberg
2011-08-16 10:46 ` Karel Zak
2011-08-17 13:07 ` Sami Kerola
2011-08-20 9:10 ` Benno Schulenberg
2011-08-20 19:08 ` Sami Kerola
2011-08-21 10:56 ` Sami Kerola
2011-08-22 8:16 ` Karel Zak
2011-08-22 18:53 ` Sami Kerola
2011-08-22 20:38 ` Benno Schulenberg
2011-08-23 8:15 ` Sami Kerola
2011-08-23 18:55 ` Benno Schulenberg
2011-08-23 19:34 ` Sami Kerola
2011-08-16 10:39 ` Karel Zak [this message]
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=20110816103937.GH1843@nb.net.home \
--to=kzak@redhat.com \
--cc=bensberg@justemail.net \
--cc=kerolasa@gmail.com \
--cc=util-linux@vger.kernel.org \
/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