help-gengetopt
[Top][All Lists]
Advanced

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

Re: [Help-gengetopt] Help about multiple options.


From: Hakan Bayındır
Subject: Re: [Help-gengetopt] Help about multiple options.
Date: Mon, 31 Jan 2022 11:01:39 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.1

Hi Wolf,

There's no need to be sorry. This is not a deal breaker in any way. I just wanted to make my code behave similarly to the other tools I use regularly, but this is not a hard requirement.

There are already two different routines parsing the arguments by themselves for their needs, but parsing it once and centrally (via gengetopt), and distributing options to the respective libraries would be a better solution in the long run, anyway.

Thanks again for your quick answer,

Cheers,
H.

On 1/30/22 17:39, Wolf wrote:
Hello,

On 2022-01-30 11:21:13 +0300, Hakan Bayındır wrote:
This allows me to pass "-v 2" or "--verbose 2" style options to set desired
verbosity, however I want to be able to pass "-v", "-vv" and similar styled
flags for verbosity selection. I've dug version 2.23 documentation but failed
to find/understand if it's possible, and how it's done.

I don't think that is currently possible with gengetopt. At least I do
not see how to do that using the current API. Two workarounds I can
think of:

1. Use --v --vv --vvv et cetera. Does not match the typical -vv pattern,
    but would work using just gengetopt.
2. Call getopt(3) separately and looks just for the -v, skipping all
    unknown. There will probably be some edge cases to figure out, but
    this should technically work?

Sorry I cannot give you a better answer.

Cheers,
W.




reply via email to

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