This will simply list the files in the current directory if there are no
auto-completion options available.
With this change, the zsh auto-completion will align with the functionality in
the bash auto-completion file provided.
New functionality: https://asciinema.org/a/EAYRIEVGTGNSS2gCGwSJ4Zw1i
Old functionality: https://asciinema.org/a/BfOZz4BHUGwjXMFptbmDHZocH
Signed-off-by: Ole Petter <ole.orhagen@northern.tech>
StringSliceFlag needs to be a pointer, and not a struct. Also formatted the test.
See: https://github.com/urfave/cli/pull/1126 for a description of the regression
tested for.
Signed-off-by: Ole Petter <ole.orhagen@northern.tech>
This adds a test verifying that the requiredFlagsError does contain the long
option of the missing flag, instead of the short option and a space, which was
the old behaviour.
Signed-off-by: Ole Petter <ole.orhagen@northern.tech>
(cherry picked from commit f842187ebb32ee7d5109783d02fe9902b68ee54e)
Instead of just resetting the temp dir, let's reset all environment
variables.
Environment variables are a pain for testing. A more reliable solution
would be to refactor all functions that read from the environment to
take the environment as an explicit argument, and then provide a
consistent environment during testing. But that would be a significantly
larger change than this one.
Related to #1105.
In some windows setups, os.TempDir() will return something like
"C:\WINDOWS" if none of the expected environment variables (TMP, TEMP,
USERPROFILE) are set, and then functions that try to create temporary
files or directories will fail since this is not writable.
Several tests in flag_test.go clear the environment and then set a small
number of specific environment variables for the test, triggering the
following error in TestFlagFromFile when I run `go test ./...` on a new
windows machine:
flag_test.go:1667: open C:\WINDOWS\urfave_cli_test851254863: Access is denied.
To work around this, we can check the temp directory before calling
os.Clearenv() and use that directory explcitly in functions that
take the temp directory.
This fixes part of #1105.