Commit Graph

1819 Commits

Author SHA1 Message Date
Gregor Noczinski
c462071a52 * Added ability to customize usage error messages 2016-02-06 21:39:35 +01:00
Jesse Szwedko
0d23d77bee Merge pull request #329 from leonardyp/master
optimization of some places
2016-02-06 11:30:49 -08:00
leonardyp
6f6e8caf6c Repeat context statement because of a is a pointer
performance  optimization
gofmt  code
2016-02-04 15:25:41 +08:00
Jesse Szwedko
cf1f63a727 Merge pull request #323 from hpcloud/master
Fixed mishandling of a "-"(dash)-argument causing reordering of cli n…
2016-01-29 19:19:57 -08:00
Jesse Szwedko
114097b816 Merge pull request #326 from tcyrus/patch-1
Update README.md
2016-01-28 18:17:57 -08:00
Timothy Cyrus
918b268473 Update README.md
Replace PNG Badge With SVG and other minor fixes
2016-01-28 20:42:14 -05:00
Andreas Kupries
bb4e78eb6a Fixed mishandling of a "-"(dash)-argument causing reordering of cli non-flag arguments.
Added test demonstrating issue (PASS with fix, FAIL without).
2016-01-26 15:34:53 -08:00
Gregor Noczinski
cb7a7c56ee * Fixed typos 2016-01-23 14:50:25 +01:00
Gregor Noczinski
7319f042e4 * Added ability to customize usage error messages 2016-01-23 12:47:24 +01:00
Gregor Noczinski
09e2c89597 * Changed the way how to return the result. Because of strange ci failure 2016-01-23 12:01:49 +01:00
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