help-gengetopt
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [help-gengetopt] Use argp for nicer output and more flexibility?


From: Simon Josefsson
Subject: Re: [help-gengetopt] Use argp for nicer output and more flexibility?
Date: Wed, 25 Jun 2003 17:20:15 +0200
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux)

Lorenzo Bettini <address@hidden> writes:

> Hi there
>
> I don't know argp actually (could you please point me to some quick
> reference about it).

The GNU libc manual has a section on argp.  argp_parse seem to be a
superset of getopt.  Try building the examples and run them, they
behave quite good with minimal effort from the developer.

> If you list what you would like from gengetopt generated code, I could
> try to implement it as soon as possible (e.g. how you'd like the
> output with --help, and so on).

The main thing that make me consider argp right now are:

* Flowed text for parameter descriptions.  This prevents writing long
  descriptions for parameters.

  E.g. compare from idn:

              --quiet               Don't print the welcome greeting 
(default=off)

  With gsasl (uses argp):

      --service=STRING       Set the requested service name (should be a
                             registered GSSAPI host based service name).

* Grouping of descriptions.  E.g., the "Network.." and "Misc..." text
  in gsasl:

...
 Network parameters:
      --connect=HOSTNAME[:SERVICE]
                             Connect to TCP server and negotiate on stream
                             instead of stdin/stdout. SERVICE is the protocol
                             service, or an integer denoting the port, and
                             defaults to 143 (imap) if not specified. Also sets
                             the --hostname default.
 
 Miscellaneous options:
      --application-data     After authentication, read data from stdin and run
                             it through the mechanism's security layer and
                             print it base64 encoded to stdout. The default is
                             to terminate after authentication.
      --imap                 Use a IMAP-like logon procedure (client only).
                             Also sets the --service default to "imap".
...

* Generates --version and --usage automatically.

Thanks,
Simon

>
> I look forward to hearing from you
>
> cheers
>       Lorenzo
>
> Simon Josefsson wrote:
>> Hello,
>> I'm using gengetopt in libidn but I'm considering moving to argp
>> which
>> IMHO is more flexible and generate nicer output.  E.g., help texts are
>> flowed (no >80 column texts), parameters can be grouped in the --help
>> output with some description text, generate --usage.  See glibc manual
>> for the entire story.
>> But then I would lose the nice code-generation idea in gengetopt,
>> and
>> the configuration file parser (which I don't need in libidn, but I
>> need it in another project which currently uses argp).
>> So it occurred to me that the best (from my point of view) would be
>> to
>> generate argp code given the gengetopt description file.  I'm not sure
>> this could be implemented completely backwards compatible, or if that
>> is even important, though.
>> Code for the argp implementation would have to be included, since it
>> isn't generally available on all platforms, but as it happen I'm
>> currently working on making the libc argp implementation portable (as
>> part of gnulib).
>> What do you think?
>> Before you ask, I don't volunteer to implement this in gengetopt. :)
>> I
>> am willing to work on any argp modifications that could be required
>> though.
>
>
> -- 
> +-----------------------------------------------------+
> |  Lorenzo Bettini          ICQ# lbetto, 16080134     |
> |  PhD in Computer Science                            |
> |  Dip. Sistemi e Informatica, Univ. di Firenze       |
> |  Tel +39 055 4796741, Fax +39 055 4796730           |
> |  Florence - Italy         (Linux User # 158233)     |
> |  Home Page        : http://www.lorenzobettini.it    |
> |  http://music.dsi.unifi.it         XKlaim language  |
> |  http://www.lorenzobettini.it/purple    Cover Band  |
> |  http://www.gnu.org/software/src-highlite           |
> |  http://www.gnu.org/software/gengetopt              |
> |  http://www.lorenzobettini.it/software/gengen       |
> +-----------------------------------------------------+
>
>
>
>
>
> _______________________________________________
> Help-gengetopt mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/help-gengetopt





reply via email to

[Prev in Thread] Current Thread [Next in Thread]