Dan Buch
1fb52b3bce
Merge remote-tracking branch 'origin/master' into string-slice-flag-default-160
2016-04-30 13:13:02 -04:00
Dan Buch
f3b589e892
Remove unreachable code
2016-04-30 12:22:32 -04:00
Dan Buch
e059dc8188
Implement *Context.GlobalSet + relevant CHANGELOG entry
2016-04-30 11:46:47 -04:00
Dan Buch
4edb5c9a6b
Merge branch 'bryanl-set-context-values' of https://github.com/bryanl/cli into bryanl-bryanl-set-context-values
2016-04-30 11:25:05 -04:00
Dan Buch
d1b0c49a98
Ensure slice types can safely round-trip through flag.FlagSet
2016-04-29 02:30:49 -04:00
Dan Buch
bd0f13d022
Add Context.GlobalFloat64 plus tests
...
Closes #362
2016-04-28 13:03:25 -04:00
Omer Murat Yildirim
802f64479d
Add NArg method to context structure
2016-02-21 15:57:11 +02:00
Jille Timmermans
f101a00018
Export cli.Flag.GetName (previously cli.Flag.getName)
2015-12-15 17:29:03 +00:00
Fabian Ruff
a2d4ae5939
Fix global flags processing on top level
...
This fixes a regression introduced by #227 . When looking up global flags by walking up the parent context's we need to consider the special case when we are starting at the very top and there is no parent context to start the traversal.
Fixes #252
2015-06-29 23:20:27 +02:00
Brian Goff
15e6b2fcc7
Add func to get context parent
...
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-06-19 17:06:04 -04:00
bryanl
a3b93076ff
Allow context value to be set after parse
...
This change allows a context value to be set after parsing. The use case is updating default settings in a Before func.
An example usage:
```
f, err := os.Open(configPath)
if err == nil {
config, err := docli.NewConfig(f)
if err != nil {
panic(err)
}
c.Set("token", config.APIKey)
}
```
2015-06-08 16:21:26 -04:00
Fabian Ruff
65d50017d4
search context hierachy for global flags
2015-05-18 23:21:33 +02:00
Ravi Gadde
bcec9b08c7
Added an API and test case for number of flags set
2015-03-10 17:18:12 -07:00
Jeremy Saenz
0cd0f1a3ae
Merge pull request #143 from artnez/master
...
Add Context.GlobalFlagNames()
2014-11-23 13:40:04 -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
Ghislain Gt
98af61a59f
Add time.Duration flag type
2014-08-02 22:32:32 +01:00
Jeremy Saenz
c7ff3bf705
Merge pull request #95 from artnez/master
...
Add FlagNames() method to Context
2014-08-02 13:05:49 -07:00
Audrius Butkevicius
6f8cfa703a
Add Args.Swap command for swapping arguments
...
The usecase:
my-cli user <USERID> set <FIELD> <VALUE>
Being able to swap <USERID> with set argument, we can have nested subcommands while preserving all variable arguments along the way.
2014-07-13 18:56:02 +01:00
Artem Nezvigin
71e3acacd2
Add FlagNames() method to Context
...
It's often useful to list all defined flags prior to launching the
program for debugging/logging purposes. This takes away the boilerplate.
2014-06-13 20:10:37 -07:00
Jeremy Saenz
bb9189510a
Merge pull request #81 from zenoss/upstream/feature/generic-flags
...
Generic parsers as flag types
2014-05-27 16:54:16 -07:00
Summer Mousa
1eaa882c3a
removed extranneous value method on the generic type
2014-04-15 09:57:11 -05:00
Summer Mousa
13e88629f5
Generic parsers as flag types
2014-04-15 09:16:47 -05:00
Chris Winslett
c69522c960
Make Command accessible from Context
2014-03-29 12:02:05 -07:00
Yicheng Qin
ce13660ae0
fix(context): copy StringSlice Flag correctly
2014-03-21 17:18:14 -07:00
Yicheng Qin
5903a0a844
Add BoolTFlag type
...
Compared to BoolFlag type, BoolTFlag treats 'true' as the default value
for the flag.
Without it, we have to use --no-action flag if we set the action is done
in default. But sometimes it is bad to maintain flags with negative meanings.
And it will be painful if we change the default value for the flag.
As this implementation, it keeps all existing functionality. So it
is compatible with old versions.
2014-03-05 17:24:22 -08:00
fraenkel
f88df0aa5a
Allow optional flags by asking if its been set/present on the command line
2013-12-18 12:09:16 -06:00
Katrina Owen
ce737fe01e
Fix typo in godoc for Float64
2013-12-05 06:33:55 -08:00
Jeremy Saenz
7be170c042
Added godoc for Float64
2013-12-03 19:24:30 -08:00
Katrina Owen
2ec51afe91
Implement Float64Flag. See #46
2013-12-03 05:42:26 -08:00
Jeremy Saenz
a4d75ab69e
Moved some code around in context.go
2013-11-28 07:53:50 -08:00
Jeremy Saenz
01b889e637
Merge branch 'master' of github.com:xyproto/cli into xyproto-master
...
Conflicts:
app.go
context.go
2013-11-28 07:51:31 -08:00
Alexander Rødseth
1bea6dcbf0
Custom type for arguments
2013-11-24 14:40:21 +01:00
Jeremy Saenz
ab6f1b7c3c
Formatting
2013-11-20 17:25:13 -08:00
Jeremy Saenz
4120b604ec
Removed help flag. we no longer need it.
2013-11-20 17:24:37 -08:00
Jared Forsyth
dc8a62e0e9
refactor, more robust flag propagation
2013-11-20 01:05:18 -07:00
Jared Forsyth
73e88630a5
fmt
2013-11-18 16:37:59 -07:00
Jared Forsyth
ccb1528bb0
adding multi-named flags
2013-11-18 16:35:23 -07:00
Alexander Rødseth
30d83a70a7
Added two convenience functions for retrieving arguments
2013-11-15 11:30:45 +01:00
Jeremy Saenz
0d3c3f4497
Improved documentation
2013-11-01 07:31:37 -07:00
Thesyncim
ed96efff1b
add simple test , fix errors and unused interface SliceFlag
2013-09-24 20:36:01 +01:00
Thesyncim
4d9038a156
add ability to parse []string types
2013-09-24 02:41:31 +01:00
Jeremy Saenz
70eacca641
JMS #25 : Added support for help flags
2013-07-24 07:35:45 -07:00
Andy Hamilton
076e26d30f
Fixed the warnings on package install
...
The following warnings were being displayed when the package was installed/used:
/usr/lib/go/src/pkg/github.com/codegangsta/cli/context.go:56: function ends without a return statement
/usr/lib/go/src/pkg/github.com/codegangsta/cli/context.go:69: function ends without a return statement
/usr/lib/go/src/pkg/github.com/codegangsta/cli/context.go:78: function ends without a return statement
2013-07-22 14:35:56 +01:00
Jeremy Saenz
6664835bc1
JMS #14 : Moving toward having and app object
2013-07-19 08:34:01 -07:00
Jeremy Saenz
59b0ce24ef
JMS #4 : Support for global flags in cli.Context
2013-07-18 18:00:52 -07:00
Jeremy Saenz
3f76896c4f
JMS #4 : Getting some cli tests going. Testing out flags
2013-07-18 17:41:22 -07:00
Jeremy Saenz
ff4e064e21
JMS #4 : Formatting
2013-07-18 17:41:22 -07:00
Jeremy Saenz
6f22315082
JMS #4 : Parsing command flags with context
2013-07-18 17:41:22 -07:00