[Libguestfs] [PATCH 1/3] test-tool: implement --short-options & --long-options

Eric Blake eblake at redhat.com
Fri Jun 29 14:53:43 UTC 2018


On 06/27/2018 05:44 AM, Pino Toscano wrote:
> While not useful per-se, it will help checking the available options.
> ---

> @@ -81,8 +82,10 @@ main (int argc, char *argv[])
>     static const char options[] = "t:V?";
>     static const struct option long_options[] = {
>       { "help", 0, 0, '?' },
> +    { "long-options", 0, 0, 0 },
>       { "qemu", 1, 0, 0 },
>       { "qemudir", 1, 0, 0 },
> +    { "short-options", 0, 0, 0 },

If it is our intent to leave these undocumented, we COULD go with naming 
them "-long-options" and "-short-options" in the long_options array. 
The bash completion script would then have to call 'utility 
---long-options' (yes, with the triple dash) - but it makes it obvious 
that they remain undocumented for internal use, and the leading - means 
that '--s' and '--l' do not cause an ambiguous abbreviation with any 
other long option that IS documented.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org




More information about the Libguestfs mailing list