Re: Help about multiple options.

Wolf <[email protected]> Sun, 30 Jan 2022 15:39:30 +0100
Newsgroups gmane.comp.gnu.gengetopt.general
Message-ID <[email protected]>
--===============5533242569767382274==
Content-Type: multipart/signed; micalg=pgp-sha512;
	protocol="application/pgp-signature"; boundary="siawrkvbtmft6t23"
Content-Disposition: inline


--siawrkvbtmft6t23
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hello,

On 2022-01-30 11:21:13 +0300, Hakan Bay=C4=B1nd=C4=B1r wrote:
> This allows me to pass "-v 2" or "--verbose 2" style options to set desir=
ed=20
> verbosity, however I want to be able to pass "-v", "-vv" and similar styl=
ed=20
> flags for verbosity selection. I've dug version 2.23 documentation but fa=
iled=20
> 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.

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

--siawrkvbtmft6t23
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEt4NJs4wUfTYpiGikL7/ufbZ/wakFAmH2oyIACgkQL7/ufbZ/
wanQMg/+LL2v88WwcF1OEdkx3EvSA+eU4unPaxLEj61MaaDaVSe+8ykZJwt2IbAm
eskN/T++aPLOQnpeDRUu6gF3FhvUSPsr1KjHJ2sIFZn2ePXzUkoHxsKYFi5ijnln
UDzfwqhyW025WuON23+/g6fouEi8bG9Ah7wxGZp9eabbYEQb9XbCTl8F0753XItJ
sFQeaLepfuAvNi0Tmu96ttug1DbQ5mB+bJu3OUnpzg2mPta6jkATeGoqmo0LetNs
XniSXEPSQiQV2NtMer50H2tsJwBTIPAJurpaCCKGq/wf03Q3Dc+7GEmVdZbibg5P
7bjx8utkbPU4sMsHgyJRuw83EAyi4kiCGMQRRsQg85CukClYNktNKwyhsFcz1BlV
2lI0yZT701uad9tCLy7sIBmeiyHZiKfvrB7GEklMTzJK1U50rGJ/BWJtc7oPbCW4
p7P3RBfAh1OUZ7O82EO8oVshJYzviA4OPRskTucKfaXE5HTvt3iDt9wgDxwEJn/i
L2hYeTs5TZlNVc3QdwIZQ1ypSKvFXLwa67+j9BW6qftX0ImcAZJPyr7VU8G21yQb
QQyWZcCr1d14Dw3X6Gv1UAc1wFWzE0s2cmksRagtnYrHyQpZRt4aJqQEMUALroPG
ELRzapXIlEzEyeEcxIT68DNll+hLBFA5HWMHhJQqJbEnxnmhuIs=
=ovcO
-----END PGP SIGNATURE-----

--siawrkvbtmft6t23--


--===============5533242569767382274==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KSGVscC1nZW5n
ZXRvcHQgbWFpbGluZyBsaXN0CkhlbHAtZ2VuZ2V0b3B0QGdudS5vcmcKaHR0cHM6Ly9saXN0cy5n
bnUub3JnL21haWxtYW4vbGlzdGluZm8vaGVscC1nZW5nZXRvcHQK

--===============5533242569767382274==--