Re: show help if no input
Lorenzo Bettini <[email protected]> Wed, 18 Aug 2010 11:42:10 +0200
| Newsgroups | gmane.comp.gnu.gengetopt.general |
|---|---|
| Message-ID | <[email protected]> |
On 17/08/2010 22.15, Duke wrote:
> Hi folks,
>
Hi there
> I just heard about gengetopt, tried it and like it very much. I want
> to change the default reaction of gengetopt a little bit to suit my
> purpose better, so I have two questions below:
>
> * When Print help, is there a way showing that one option is optional
> and the other is required? For now, help shows only options and their
> descriptions and values, no way to know if an option is optional or
> required until one tries the program and some of its options.
>
for the moment this is not implemented, although in the summary of
command invocation optional options should be printed differently (I
should check this, I don't remember it right now and cannot check it now).
Surely, this behavior could be added (by using a command line switch of
gengetopt itself); I should work on this (or if you want to try to
implement it...)
> * When there is no input (no argument or argc < 2), is there a way of
> telling gengetopt to show help, even if there are required options?
> For now, if there is required option, and if the program is invoked
> without argument, then "option required" shows up, not the help.
>
this could be implemented in your program itself; as long as you init an
args_info structure, then you could check argc and in case call the
print help generated function directly; have you tried this?
hope to hear from you soon
cheers
Lorenzo
--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net