Commit Graph

1975 Commits

Author SHA1 Message Date
Erin Call
fcce511478
Refactor fishAddFileFlag for better flexibility [#1156]
Performing reflection on the given flag ensures that fishAddFileFlag
will behave correctly if any flag types get a TakesFile field in the
future.
2020-10-13 13:00:19 -07:00
Erin Call
0d11bd55f5
Merge remote-tracking branch 'origin/master' into paths-take-files 2020-10-13 11:33:31 -07:00
Igor Artasevych
27a8625ccd #1193 Expose constructor of MapInputSource type 2020-10-08 18:38:59 +03:00
Sascha Grunert
cd82784a53
Merge pull request #1192 from Charliekenney23/fix-typo
fix grammatical error
2020-10-08 09:19:23 +02:00
Charles Kenney
e5407cccf7
fix grammatical error 2020-10-06 22:24:56 -04:00
Adam Farden
342ce5d654 feature: Add a App.Reader that defaults to os.Stdin
Closes: #1190
2020-10-02 12:39:44 +02: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
Lucas Charles
8e9b8ccfa6 Bump gopkg.in/yaml.v2 to v2.2.3
Fixes susceptibility to billion laughs attack,
see GitLab Gemnasium advisory for details
d769b9b5f0/go/gopkg.in/yaml.v2/GMS-2019-2.yml
2020-09-18 09:16:14 -07:00
knqyf263
74af85a00d feat(help): add ShowSubcommandHelpAndExit 2020-09-08 17:53:16 +03: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
Alberts Zemzale
d273947592 Remove incorrect bracket in v2 docs example 2020-08-23 13:35:59 +03:00
Steven Imle
be9c037806 Added template functions for multi-line Description formatting. 2020-08-17 16:02:40 -04:00
Alberts Zemzale
bed468fb76 Fix v1 aliases syntax in v2 docs 2020-08-13 19:15:35 +03: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
Erin Call
5bb54ace57
fish.go: support PathFlag.TakesFile [#1156] 2020-06-22 17:24:44 -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
kirinnee
9523a3481b
Updated Docs Header in table of content for PowerShell support 2020-06-08 10:54:27 +08: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
kirinnee
b236763df5
Added manual and script for PowerShell autocomplete 2020-05-18 11:19:00 +08: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