[Top][All Lists]

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

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

From: Wolf
Subject: Re: [Help-gengetopt] Help about multiple options.
Date: Sun, 30 Jan 2022 15:39:30 +0100


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.


There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.

Attachment: signature.asc
Description: PGP signature

reply via email to

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