Commit Graph

1912 Commits

Author SHA1 Message Date
Charles Kenney
e5407cccf7
fix grammatical error 2020-10-06 22:24:56 -04:00
Sascha Grunert
f53989457f
Merge pull request #1178 from alexcb/master
bugfix: don't overwrite existing stringslice refence
2020-09-21 23:40:16 +02:00
Alex Couture-Beil
2ae03fa69c bugfix: don't overwrite existing stringslice refence
fixes an issue where values set by environment var are not saved to
existing stringslice reference.
2020-08-24 14:20:17 -07:00
Robert Liebowitz
d2d2098085
Merge pull request #1160 from vschettino/flag-timestamp-value
Allow using Value with TimestampFlag
2020-07-12 09:32:01 -04:00
Vinicius Schettino
54fbe0a445 Basic test case to check if Value is propagated as it should 2020-07-11 15:55:19 -03:00
Vinicius Schettino
7ecfd216b1 Verify whether there is a Value before overriding 2020-07-11 15:54:46 -03:00
lynn (they)
8e16b98d40
Merge pull request #1158 from s4uliu5/patch-1
Fix small manual typo
2020-07-01 19:49:08 -07:00
Saulius Gurklys
dff8accf57
Fix typo
Fixed small typo.
2020-07-01 23:20:25 +03:00
lynn (they)
9047f3b42d
Merge pull request #1153 from Irioth/master
Bugfix: Remove version flag from commands with subcommands
2020-06-23 09:23:47 -07:00
Irioth
ef2d047c45 added test for successfully used -v flag on command with subcommands 2020-06-18 09:34:54 +03:00
Irioth
1f3e0b5233 make test more general and stable 2020-06-18 01:02:47 +03:00
Irioth
44371a2ac6 test for version flag on commands 2020-06-18 00:46:15 +03:00
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