[Top][All Lists]

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

Re: [help-gengetopt] show help if no input

From: Duke
Subject: Re: [help-gengetopt] show help if no input
Date: Wed, 18 Aug 2010 17:05:13 -0400
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv: Gecko/20100802 Lightning/1.0b2 Thunderbird/3.1.2

 On 8/18/10 2:35 PM, Lorenzo Bettini wrote:
when you use -h|--help, but you must have generated the command line parser with

 -l, --long-help               long usage line in help

(this is an option to be passed to gengetopt)

then, when print the output of help you'll have something similar

Usage: sample1 -iINT|--int-opt=INT [-h|--help] [--detailed-help] [--full-help] [-V|--version] [-sfilename|--str-opt=filename] [-mINT|--my-opt=INT] [--flag-opt] [-F|--funct-opt] [--long-opt=LONG] [--def-opt=STRING]
              [--enum-opt=STRING] [-DINT|--dependant=INT] [FILES]...

Oh I see. Thanks.

by the way, I've just realized there's already something for this (see also the manual):

if --show-required is given, possibly with a string, in the output of --help will be made explicit which options are actually required,

Yes, --show-required does the job. The required options now have "(mandatory)" string.

I meant something different: before invoking

cmdline_parser (argc, argv, &args_info) != 0

you could do something similar (not checked it myself)

if (argc < 2) {
cmdline_parser_init (&args_info);
return -1;

Yes, it does exactly as I wanted. "cmdline_parser_init (&args_info);" is the command I tried to look for but couldnt. I know I will have to init it before the parser, but just dont know which command to do that.

Thank you very much Lorenzo, all problem solved now.


does this do what you need?

please, let me know

reply via email to

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