Commit Graph

1618 Commits

Author SHA1 Message Date
Dario Castañé
dca177c384 After handler brought up to speed.
As discussed in issue #151, I modified the implementation to be simpler.
I checked how to propagate err, being done with a scope trick. From our
deferred function we cannot return a new value, so we override the "default"
return value (err), declared on functions' declarations.

Check this StackOverflow for more info: http://stackoverflow.com/a/19934989
2015-01-10 00:51:06 +01:00
Dario Castañé
4ab12cd639 jszwedko's suggestion done 2015-01-10 00:44:37 +01:00
Dario Castañé
4e3a83b43e Merge branch 'master' of https://github.com/codegangsta/cli
Conflicts:
	app.go
	app_test.go
2015-01-10 00:35:11 +01:00
jszwedko
5159b98cbc Use parsed context when running command as subcommnd
Rather than passing the unparsed context (parent context) in whenever
there are no subcommands.
2015-01-09 14:46:29 -05:00
Jesse Szwedko
bf4a526f48 Merge pull request #157 from dajulia3/pull_request
stop flag parsing after terminator --
2015-01-09 14:04:33 -05:00
97112754e1 Merge pull request #169 from codegangsta/use-0-as-int-base
Use 0 as the base when parsing ints
2015-01-09 13:13:49 -05:00
jszwedko
44d40054fa Use 0 as the base when parsing ints
To be consistent with what the stdlib flag package does.
2015-01-09 13:10:42 -05:00
Jesse Szwedko
3005aa4907 Merge pull request #168 from szaydel/fixParseUint-Flag
strconv.ParseInt should be used instead of strconv.ParseUint when readin...
2015-01-09 13:10:19 -05:00
Sam Zaydel
ef23aa6da2 strconv.ParseInt should be used instead of strconv.ParseUint when reading Int Flags from envvars. 2015-01-09 05:53:14 -08:00
aee58516e6 Merge pull request #167 from codegangsta/use-double-quotes-in-defaults
Use double quotes in output for defaults
2015-01-08 16:28:32 -05:00
jszwedko
059c02782a Use double quotes in output for defaults
Windows doesn't recognize 's for wrapping values. "s should work on all
systems.
2015-01-08 15:35:23 -05:00
21d399c3fa Merge pull request #166 from codegangsta/fix-generic-flag-help-text
Fix help text for generic flag to not insinuate that you can specify mul...
2015-01-08 14:50:16 -05:00
5b9e204508 Merge pull request #153 from codegangsta/allow-hiding-of-help-flag
Allow hiding of help flag without hiding help subcommand
2015-01-08 14:49:36 -05:00
jszwedko
22dbe6ffdc Fix help text for generic flag to not insinuate that you can specify multiple
Feels like it may have been copied from StringSliceFlag or something,
but update the output to be more consistent with other single value
flags.

Also added comments to the String and Apply functions.
2015-01-08 14:27:09 -05:00
Matthew McNew
d05d895492 stop flag parsing after terminator --
Signed-off-by: David Wadden <dwadden@pivotal.io>
2014-12-17 09:56:05 -06:00
a14c5b47c7 Merge pull request #154 from codegangsta/allow-writer-to-be-set
Allow writer to be set
2014-12-12 08:50:46 -05:00
Jesse Szwedko
e7849f9239 Merge pull request #128 from nbjahan/patch-1
Fixed ShowSubcommandHelp
2014-12-11 20:37:53 -05:00
jszwedko
69b84ea804 Renaming fakeWriter to mockWriter for consistency 2014-12-10 10:33:59 -05:00
Jesse Szwedko
fbda1ce02d Merge pull request #141 from meatballhat/multi-env-var
Adding support for multiple env var "cascade"
2014-12-03 16:09:45 -05:00
Jesse Howarth
8f1fb06a58 Merge pull request #1 from ivey/required_flags
Required flags
2014-12-02 15:23:01 -08:00
Jesse Howarth and Michael Ivey
4b2fcdb1ad Add tests for required flags 2014-12-02 21:13:46 +00:00
Jesse Howarth and Michael Ivey
73e64a14fd Add (required) to help of flags that are required. 2014-12-02 21:13:26 +00:00
Jesse Howarth and Michael Ivey
7e05320026 Implement required flags 2014-12-02 17:44:55 +00:00
jszwedko
e72094e6a4 Prefer fmt.Fprint* functions over io.WriteString
Less composition needed.
2014-12-01 23:57:35 -05:00
jszwedko
b8c8282de5 Merge remote-tracking branch 'origin/master' into allow-writer-to-be-set
Conflicts:
	app.go
	help.go
2014-12-01 23:51:35 -05:00
jszwedko
0d4870d63e Rename Stdout -> Writer 2014-12-01 23:50:04 -05:00
jszwedko
780f839a02 Allow hiding of help flag without hiding help subcommand
By utilizing struct zero value
2014-12-01 23:21:22 -05:00
Dan Buch
1dce44d781 Adding section in README about env var cascade
as well as moving a line back up where it belongs
2014-12-01 22:46:57 -05:00
Dan Buch
dca23da84b Merge remote-tracking branch 'origin/master' into multi-env-var 2014-12-01 22:44:36 -05:00
Jeremy Saenz
9908e96513 Update README.md 2014-11-23 13:46:56 -08:00
Jeremy Saenz
b731cdcd0b Merge pull request #152 from OVYA/master
Fix bash completion for deep level subcommands
2014-11-23 13:40:21 -08:00
Jeremy Saenz
0cd0f1a3ae Merge pull request #143 from artnez/master
Add Context.GlobalFlagNames()
2014-11-23 13:40:04 -08:00
Jeremy Saenz
bfc92c213e Merge pull request #146 from jhowarth/master
Add a function to determine if a global flag is set
2014-11-19 13:44:52 -08:00
pivaldi
59ef9567ae Fix bash completion for deep level subcommands 2014-11-19 11:05:01 +01:00
Dario Castañé
ba22f2189a Changing back cli import in app_test.go 2014-11-19 00:28:57 +01:00
Dario Castañé
3c4b583fee Action error shadowing avoided on After 2014-11-18 23:54:27 +01:00
Dario Castañé
44efc2952d Added Before method to command and app 2014-11-18 23:44:21 +01:00
Jesse Szwedko
229729fae6 Merge pull request #150 from kytrinyx/readme-example
Clarify example in README. Fixes #149
2014-11-13 13:20:49 -05:00
Katrina Owen
993877b447 Clarify example in README. Fixes #149 2014-11-13 06:27:03 -08:00
Jesse Szwedko
61f43e7695 Merge pull request #147 from peterbourgon/master
Make -v, --version optional
2014-11-12 09:51:28 -05:00
Peter Bourgon
179c7a5f7c Make -v, --version optional 2014-11-12 12:38:58 +01:00
Jesse Howarth
a6bafbe9a5 Add additional test 2014-11-11 12:50:40 -08:00
Jesse Howarth
b490b5e35d Add a function to determine if a global flag is set. 2014-11-11 12:48:07 -08:00
Artem Nezvigin
6db418e461 Add Context.GlobalFlagNames() 2014-10-02 15:17:57 -07:00
f7ebb761e8 Merge pull request #137 from nyushi/fix-example-code
Fix example code
2014-09-22 23:34:35 -04:00
78d497e4cf Adding support for multiple env var "cascade" 2014-09-22 23:28:57 -04:00
Yushi Nakai
9610ab1729 Fix example code 2014-09-15 21:03:35 +00:00
Katrina Owen
683e911d61 Return error from app and command actions. See #66.
This introduces a significant breaking change, and I don't expect it to
be merged off-hand. I do think that it's worth discussion, since it
seems like a very idiomatic choice in terms of how errors would be handled.

A similar backwards-incompatible change was introduced in e6e64114,
allowing the app's Run method to return an error.
2014-08-31 11:40:47 -07:00
Jesse Szwedko
7381bc4e62 Merge pull request #134 from Zearin/patch-1
Minor README tweaks
2014-08-27 20:51:55 -04:00
Tony
023450545e Minor README tweaks 2014-08-24 12:28:10 -04:00