Commit Graph

444 Commits

Author SHA1 Message Date
Gregor Noczinski
82ddbd9a07 * Improve GenericFlag.String() by suppressing empty "" for GenericFlags on nil or empty Generic.String()
* Cleanup StringFlag.String()
* Add os specific envHint handling for Windows (%ENV_VAR% instead of $ENV_VAR on posix systems)
2016-01-22 15:08:27 +01:00
Jesse Szwedko
f9cc3001e0 Merge pull request #315 from blaubaer/master
Improved Before/After handling for Commands
2016-01-21 21:44:38 -08:00
Jesse Szwedko
ca6f864fa3 Merge pull request #320 from technosophos/master
Remove panic from help.
2016-01-21 21:11:01 -08:00
Matt Butcher
54b6cca78e Remove panic from help.
There is a panic in printHelp that can be trivially triggered when the
shell closes os.Stdout. This happens, for example, when data is piped
between a cli app and something else.

See https://github.com/helm/helm/issues/387
2016-01-20 14:51:55 -07:00
Gregor Noczinski
01fdb2cca9 #315 fixed typo 2016-01-20 10:56:46 +01:00
Gregor Noczinski
f3c8e07836 Also show help if App/Command Before produces error. 2015-12-25 22:08:22 +01:00
Gregor Noczinski
f90cd56647 Handle Before and After of Command without handling it as subCommand if there is no subCommand. 2015-12-25 21:45:58 +01:00
Jesse Szwedko
c31a797586 Merge pull request #311 from Jille/exportFlagNames
Export cli.Flag.GetName (previously cli.Flag.getName)
2015-12-21 13:40:36 -05:00
Jesse Szwedko
8eb7738f18 Merge pull request #312 from ysh7/master
use path.Base in Name & HelpName as default values
2015-12-21 13:39:19 -05:00
Yagnesh Mistry
b0b9bd5dac use path.Base in Name & HelpName as default values 2015-12-18 23:28:32 +05:30
Jille Timmermans
f101a00018 Export cli.Flag.GetName (previously cli.Flag.getName) 2015-12-15 17:29:03 +00:00
Jesse Szwedko
b5232bb293 Merge pull request #309 from dedalusj/check-completion-order
Run check completion before error checking
2015-12-12 19:52:18 -05:00
Jacopo
4a8406ac89 Run check completion before error checking
Running check completion before error checking allows for completion of flags when no character has been typed yet
2015-12-13 09:39:01 +10:00
Jesse Szwedko
a3c75bc94e Merge pull request #304 from osocurioso/silence-tests
test: avoid output from "go test" when tests pass
2015-12-12 17:25:10 -05:00
Håvard Haugen
7b94fd3aad test: avoid output from "go test" when tests pass
Some tests where printing to os.Stdout as a side effect even if the
output was not used/checked in the test.
2015-11-28 18:26:10 +01:00
Jesse Szwedko
0302d3914d Merge pull request #283 from codegangsta/really-skip-flag-parsing
Really skip flag parsing
2015-11-20 13:56:42 -08:00
Jesse Szwedko
c75c9d0182 Merge pull request #298 from codegangsta/use-correct-example-naming
Use correct example naming and test on Go tip
2015-11-15 13:47:47 -08:00
Jesse Szwedko
0f218fffa5 Remave cli_test.go
Examples are redundant with the ones in app_test.go
2015-11-15 13:34:53 -08:00
Jesse Szwedko
631930114f Also test on Go tip
But allow it to fail
2015-11-15 13:14:18 -08:00
Jesse Szwedko
4fc241fb17 Update examples to use correct naming convention
See https://golang.org/pkg/testing/#hdr-Examples
2015-11-15 13:14:11 -08:00
Jesse Szwedko
49bed4ccde Merge pull request #295 from rosenhouse/update-travis-versions
Update golang versions used by Travis CI
2015-11-15 13:05:45 -08:00
Jesse Szwedko
93b4ad6d1f Merge pull request #297 from ston1th/master
Added destination scan support for flags
2015-11-15 12:34:56 -08:00
ston1th
4579bbf129 added description to README.md 2015-11-15 10:59:12 +01:00
ston1th
25ef368235 added destination scan testing and BoolT 2015-11-14 22:39:38 +01:00
ston1th
bb7e45acf1 Added destination scan support for flags 2015-11-14 20:01:15 +01:00
Gabe Rosenhouse
7c6caf69ef Update golang versions used by Travis CI
- current latest: 1.5.1
2015-11-13 23:47:41 -08:00
Nathan LeClaire
3323ab4460 Use a test table and add --help test
Signed-off-by: Nathan LeClaire <nathan.leclaire@gmail.com>
2015-10-29 20:17:12 -07:00
Jesse Szwedko
8cd49b108c Update TestCommandIgnoreFlagsIncludingFirstArgument to test for arguments 2015-10-29 20:16:35 -07:00
Jesse Szwedko
6191d931b7 When skipping flag parsing, still parse into arguments
Fool the FlagSet into thinking that all arguments are actually
arguments rather than attempting to parse them as flags.
2015-10-29 20:16:35 -07:00
Jesse Szwedko
bc3cb33cef Actually skip parsing of flags if SkipFlagParsing is set
Previous just skipped if firstFlagIndex was > -1
2015-10-29 20:16:35 -07:00
Nathan LeClaire
c538c376c9 Do not return error when flag parsing should be skipped
Signed-off-by: Nathan LeClaire <nathan.leclaire@gmail.com>
2015-10-29 20:16:35 -07:00
Jesse Szwedko
70e3fa51eb Merge pull request #292 from Jille/remove-unused-var
bash_autocomplete: Remove unused local variable prev
2015-10-29 20:11:27 -07:00
Jille Timmermans
34639643ac bash_autocomplete: Remove unused local variable prev 2015-10-28 14:39:36 +00:00
Kaushal Subedi
c70ad9b688 fixed tests 2015-10-24 23:51:06 -06:00
Kaushal Subedi
8b46886de8 added flag to have a custom text on the USAGE section of help 2015-10-24 23:37:21 -06:00
Jesse Szwedko
f445c89440 Merge pull request #284 from rbjorklin/readme-update
Added coverage and reference logos to README.md
2015-10-21 22:00:38 -07:00
Jesse Szwedko
cffab77ecb Merge pull request #286 from mktmpio/dedup-help-and-version
only display app version and help message once
2015-10-18 17:28:50 -07:00
Ryan Graham
732e97aee8 only display app version and help message once
When processing the flags for -h/--help and -v/--version, only check
the flags in checkVersion() and checkHelp() instead of also printing
the associated message.

This fixes the problem of `app -h` and `app -v` printing their output
twice. The doubling was caused by printing the message once for each
registred alias for the given flags (-h/--help and -v/--version).

Resolves #285
2015-10-18 17:02:23 -07:00
Robin Björklin
443fff6934 Added coverage and reference logos to README.md 2015-10-18 20:32:50 +02:00
Jesse Szwedko
aba9469083 Merge pull request #282 from cactus/master
make help and version parsing use actual specified values
2015-10-17 11:54:49 -07:00
elij
db7af859d2 make help and version parsing use actual specified values
fixes #254
2015-10-13 15:20:36 -07:00
Jesse Szwedko
96f1fedb28 Merge pull request #281 from thiderman/patch-1
Remove 'bitchass' from README
2015-10-06 19:46:01 -07:00
Jesse Szwedko
9039757268 Merge pull request #267 from tristanz/master
Add ArgsUsage field to document the use of arguments
2015-10-06 19:45:04 -07:00
Lowe Thiderman
be8ef15245 Remove 'bitchass' from README
Having needless derogatory words in the description of the project is just juvenile, and this stood out as a blemish on an otherwise pretty flawless introduction.
2015-10-06 20:17:33 +02:00
Jesse Szwedko
88df06b5e3 Merge pull request #279 from nodirt/version
Honor HideHelp and HideVersion
2015-10-05 20:26:32 -07:00
Jesse Szwedko
f35cf683a8 Merge pull request #280 from gummiboll/fix-for-testcommandignoreflags
Added a flag for TestCommandIgnoreFlags
2015-10-05 20:05:46 -07:00
Emil Thelin
a9585bb11c Added a flag for TestCommandIgnoreFlags 2015-10-03 17:19:04 +02:00
Nodir Turakulov
c80fcac42b Honor HideHelp and HideVersion
App.Run does not check a.Hide{Help,Version} before checking it,
as a result customers cannot define their own -v flag (e.g. for verbose)
2015-09-27 23:42:17 -07:00
Jesse Szwedko
a65b733b30 Merge pull request #275 from langri-sha/master
Improve formatting
2015-09-08 18:48:53 -07:00
Filip Dupanović
4ad8f298e2 Improve formatting 2015-09-08 11:00:04 +02:00