Commit Graph

1900 Commits

Author SHA1 Message Date
Irioth
6d09498169 hide version flag for subcommands 2020-06-18 00:24:04 +03:00
lynn (they)
4f74020d9f
Merge pull request #1148 from tmatias/patch-1
fix link to docs on v2 manual
2020-06-16 13:49:51 -07:00
Tiago Matias
5b263d0ace
fix link to docs on v2 manual
was pointing to v1 docs
2020-06-15 12:04:06 -03:00
lynn (they)
b190f2d2fc
Merge pull request #1127 from sgoroshko/master
fix #1121(StringSliceFlag set default value into destination)
2020-06-03 17:17:52 -07:00
Sergey Goroshko
10fe017765 fix nested conditions 2020-05-31 20:52:18 +03:00
Robert Liebowitz
477292c8d4
Merge pull request #1137 from TomOnTime/envars
Document EnvVar change
2020-05-13 06:04:02 -04:00
Tom Limoncelli
42aad27f4c Document EnvVar change 2020-05-12 08:11:29 -04:00
lynn (they)
61026898ff
Merge pull request #1130 from oleorhagen/zshfiles
fix(zsh_autocomplete): List files on tab with no completion options
2020-05-04 14:54:48 -07:00
lynn (they)
fdf2d38b2a
Merge pull request #1129 from oleorhagen/reqflagr
Reqflagr
2020-05-04 14:36:22 -07:00
Ole Petter
b27d899434
fix(zsh_autocomplete): List files on tab with no completion options
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>
2020-05-03 12:10:39 +02:00
Ole Petter
48392103ce
test(context): Change the StringSliceFlag to a pointer
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>
2020-05-03 11:14:51 +02:00
Ole Petter
710c8f71c4
test(context): Added regression test for requiredFlagsError
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)
2020-05-02 19:50:03 +02:00
Sergey Goroshko
196b222a8b fix #1121(StringSliceFlag set default value into destination) 2020-05-01 23:06:09 +03:00
Robert Liebowitz
464c868816
Merge pull request #1117 from creekorful/harmonize-error-handling
Harmonize BeforeError handling
2020-04-28 06:33:12 -04:00
Aloïs Micard
c261e4dbd3
Harmonize BeforeError usage in Command#Run 2020-04-28 08:04:17 +02:00
Aloïs Micard
33744eb004
Harmonize BeforeError handling 2020-04-27 19:50:15 +02:00
lynn
4bb97e00e0
Merge pull request #1109 from mostynb/test_reset_entire_env
Reset the environment variables after each test that clears them
2020-04-24 18:30:38 -07:00
Mostyn Bramley-Moore
4853dd3144 Reset the environment variables after each test that clears them
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.
2020-04-15 08:32:07 +02:00
Robert Liebowitz
3b22cad8d7
Merge pull request #1107 from mostynb/test_environment_tempdir
Save the temp dir before clearing environment variables
2020-04-14 06:40:52 -04:00
Robert Liebowitz
3e069af0ca
Merge pull request #1106 from mostynb/windows_drive_letter
Don't assume a fixed windows drive letter in tests
2020-04-14 06:33:23 -04:00
Mostyn Bramley-Moore
8d907b5329 Save the temp dir before clearing environment variables
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.
2020-04-14 07:55:17 +02:00
Mostyn Bramley-Moore
9eb96e77a1 Don't assume a fixed windows drive letter in tests
Prior to this change, this test was failing for me on a new windows
machine, with mismatching drive letters:

helpers_test.go:20: (C:/Users/Foo Bar/cli/altsrc/flag_test.go:195) Expected C:\path\to\source\hello (type string) - Got D:\path\to\source\hello (type string)

Rather than hard-coding the drive letter in the expected path, we can
expect the filepath.Abs'ed version.

This should fix part of #1105.
2020-04-14 07:42:42 +02:00
lynn [they]
7a390105cb
Merge pull request #1098 from TomOnTime/migration
Add a v1 => v2 migration guide
2020-04-06 16:23:21 -07:00
Tom Limoncelli
2f5b961b06 Link to migration guide 2020-04-04 06:13:16 -04:00
Tom Limoncelli
9fd9cd1117 Link to migration guide 2020-04-04 06:09:14 -04:00
lynn [they]
95b323fc6f
Merge pull request #1100 from Nokel81/set-err-writer
Set App.ErrWriter in App.Setup()
2020-04-01 20:48:17 -07:00
lynn [they]
51a22574bf
Merge pull request #1102 from urfave/lynncyrin-patch-1
Release 1.22.4
2020-04-01 11:32:32 -07:00
Sebastian Malton
fed64f3ad7 add tests 2020-04-01 09:17:59 -04:00
Tom Limoncelli
200fa41ab3 Revert v2/manual.md 2020-03-31 18:59:44 -04:00
Tom Limoncelli
be370eb485 Re-order items to be more logical. 2020-03-31 18:58:39 -04:00
Tom Limoncelli
84c98fac3e Move migration to a separate file.Move migration to a separate file 2020-03-31 18:54:05 -04:00
lynn [they]
f41aa2567f
Update CHANGELOG.md 2020-03-31 15:01:22 -07:00
lynn [they]
28789a9775
Update CHANGELOG.md 2020-03-31 15:00:40 -07:00
lynn [they]
fa64b8efd0
Merge pull request #1099 from urfave/lynncyrin-patch-1
Remove leading whitespace in PR template
2020-03-31 14:46:17 -07:00
Sebastian Malton
22b6dbaad3 Set App.ErrWriter in App.Setup()
- Defaults to os.Stderr
- Remove the App.errWriter() function since it is no longer needed
2020-03-31 10:43:36 -04:00
lynn [they]
3020108d13
Update pull_request_template.md 2020-03-30 16:27:15 -07:00
lynn [they]
39f9fbd723
Merge pull request #1086 from akramarenkov/fix-altsrc-nil-source-flag
Fix bug 'Unable to load file' in altsrc
2020-03-30 16:25:52 -07:00
Tom Limoncelli
dc7ae10a15 fixup! 2020-03-30 10:57:50 -04:00
Tom Limoncelli
caa97b585e Fix TOC 2020-03-29 11:29:34 -04:00
Tom Limoncelli
9faa4e4097 Fix TOC 2020-03-29 11:26:02 -04:00
Tom Limoncelli
6b3b21728c Fix TOC 2020-03-29 11:24:23 -04:00
Tom Limoncelli
228f1c9c58 fixup! 2020-03-29 11:15:13 -04:00
Tom Limoncelli
7a4368def7 fixup! 2020-03-29 11:11:03 -04:00
Tom Limoncelli
710df05119 Add a v1 => v2 migration guide 2020-03-29 11:02:05 -04:00
Robert Liebowitz
dd51d24ce6
Merge pull request #1091 from rliebz/document-exit-errors
Update docs and tests around cli.Exit
2020-03-25 17:52:14 -04:00
Robert Liebowitz
959cf9de8a Update docs and tests around cli.Exit
Some of the docs were lacking or incomplete concerning how to properly
use cli.Exit, cli.HandleExitCoder, and the ExitErrHandler field on cli.App.
This change aims to clarify the usage of those pieces.

I also noticed that we have two identical functions now: cli.Exit and
cli.NewExitError. Since the latter seems to be more recent and less well
documented, I went ahead and marked it as deprecated so that we can keep
our public interface small.

Also added a missing test case for behavior that's been around a while
but was not documented or tested.

Related: #1089
2020-03-24 20:32:39 -04:00
lynn [they]
1c4bb12e86
Merge pull request #1087 from l1905/master
fix typo in v2 manual.md demo code
2020-03-18 09:31:05 -07:00
litongxue
f7ef1e38d6 fix typo in v2 manual.md demo code 2020-03-18 14:32:57 +08:00
Aleksandr Kramarenko
8f64abd176 Simplified 2020-03-12 21:20:13 +03:00
lynn [they]
120c9eead1
Merge pull request #1084 from urfave/lynncyrin-patch-1
Release 2.2.0
2020-03-10 12:44:57 -07:00