Only split a given string (e.g., "-abc") into short options (e.g., "-a",
"-b", "-c") if all those are flags. To further avoid mistakenly
transform common arguments, catch "flag provided but not defined" errors
to iteratively transform short options.
Signed-off-by: Valentin Rothberg <vrothberg@suse.com>
Fixes: https://github.com/projectatomic/libpod/issues/714
Adds the ability to allow the combination of bool
short-name options. For example,
cmd foobar -ov
This is done through a bool "UseShortOptionHandler" set in
the command struct.
Built upon PR #621
Signed-off-by: baude <bbaude@redhat.com>
This makes sorting flags and other sections consistent with how most
command line tools function, by placing both flags `-A` and `-a` before
a flag `-B`.
Currently cli silently (aside from IntSlice and Int64Slice which oddly
printed directly to the error stream) ignores failures that occur when
parsing environment variables for their value for flags that define
environment variables. Instead, we should propogate up the error to the
user.
This is accomplished in a backwards compatible manner by adding a new,
internal, interface which defines an applyWithError function that all
flags here define. In v2, when we can modify the interface, we can drop
this secondary interface and modify `Apply` to return an error.
In the unreleased version 2, the argument reordering has been removed
(in f585ec7cb8) since it only worked if
all of the arguments appeared before all of the flags, but not if they
were intermixed which was of limited utility and caused some confusion.
This commit allows enabling of this future behavior via SkipArgReorder.
Ideally we'd support complete intermingling of flags and arguments, but
this is unlikely to happen until we switch flag parsers.
Fixes#515
Just place all subcommands in categories, the default category will be
"" which will properly format the output (and group commands that have
no category).
Also allow subcommands to have categories.
Lastly, augment the test to check the output.