Dan Buch
a0e694ed72
Add UintFlag, Uint64Flag types and supporting code
8 years ago
Bruno França dos Reis
5c7cca7f16
Adding Int64Slice related stuff in flag.go and context.go, and related tests
8 years ago
Bruno França dos Reis
80d3d863d9
Adding Int64 and GlobalInt64 in context, plus related tests
8 years ago
Dan Buch
3d75e9e711
Go with interfaces + private opaque types
...
rather than public types that wrap slices
8 years ago
Dan Buch
61710ff108
Make slice wrapping pattern more consistent
...
and move *Args out into its own file
8 years ago
Dan Buch
cd10b49473
Minimize struct copying
...
by using pointer func receivers and slices of struct pointers where possible.
8 years ago
Dan Buch
81fcf706ea
Replace all "stringly typed" fields with slice equivalents
...
and alter the Flag interface accordingly
Closes #415
8 years ago
Dan Buch
f2d5ed9933
Replace BoolTFlag type with BoolFlag.Value
...
Closes #412
8 years ago
Dan Buch
7318e27528
Tidy up the flag name visitor func in Context
8 years ago
Dan Buch
c720f37e15
Context tests and tweaks around lineage traversal
...
per feedback on #410
8 years ago
Dan Buch
bef835d455
Remove all Context.Global* methods
...
and change the behavior of the non-Global variants to always search up the
context lineage.
Closes #385
8 years ago
Dan Buch
32ebecfbb5
Merge remote-tracking branch 'origin/master' into v2
8 years ago
Matt Farina
2f110bd745
Cleaned up exported func comments per golint
8 years ago
Dan Buch
bac790c819
Merge remote-tracking branch 'origin/master' into v2
8 years ago
Jesse Szwedko
e3ace79a91
Add GlobalBoolT
...
Fixes #206
8 years ago
Dan Buch
1fb52b3bce
Merge remote-tracking branch 'origin/master' into string-slice-flag-default-160
9 years ago
Dan Buch
f3b589e892
Remove unreachable code
9 years ago
Dan Buch
e059dc8188
Implement *Context.GlobalSet + relevant CHANGELOG entry
9 years ago
Dan Buch
4edb5c9a6b
Merge branch 'bryanl-set-context-values' of https://github.com/bryanl/cli into bryanl-bryanl-set-context-values
9 years ago
Dan Buch
d1b0c49a98
Ensure slice types can safely round-trip through flag.FlagSet
9 years ago
Dan Buch
bd0f13d022
Add Context.GlobalFloat64 plus tests
...
Closes #362
9 years ago
Omer Murat Yildirim
802f64479d
Add NArg method to context structure
9 years ago
Jille Timmermans
f101a00018
Export cli.Flag.GetName (previously cli.Flag.getName)
9 years ago
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
9 years ago
Brian Goff
15e6b2fcc7
Add func to get context parent
...
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
9 years ago
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)
}
```
9 years ago
Fabian Ruff
65d50017d4
search context hierachy for global flags
9 years ago
Ravi Gadde
bcec9b08c7
Added an API and test case for number of flags set
10 years ago
jhowarth
145da3210f
don't require flags when the help flag is included
10 years ago
Jesse Howarth and Michael Ivey
7e05320026
Implement required flags
10 years ago
Jeremy Saenz
0cd0f1a3ae
Merge pull request #143 from artnez/master
...
Add Context.GlobalFlagNames()
10 years ago
Jesse Howarth
b490b5e35d
Add a function to determine if a global flag is set.
10 years ago
Artem Nezvigin
6db418e461
Add Context.GlobalFlagNames()
10 years ago
Ghislain Gt
98af61a59f
Add time.Duration flag type
10 years ago
Jeremy Saenz
c7ff3bf705
Merge pull request #95 from artnez/master
...
Add FlagNames() method to Context
10 years ago
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.
10 years ago
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.
10 years ago
Jeremy Saenz
bb9189510a
Merge pull request #81 from zenoss/upstream/feature/generic-flags
...
Generic parsers as flag types
10 years ago
Summer Mousa
1eaa882c3a
removed extranneous value method on the generic type
11 years ago
Summer Mousa
13e88629f5
Generic parsers as flag types
11 years ago
Chris Winslett
c69522c960
Make Command accessible from Context
11 years ago
Yicheng Qin
ce13660ae0
fix(context): copy StringSlice Flag correctly
11 years ago
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.
11 years ago
fraenkel
f88df0aa5a
Allow optional flags by asking if its been set/present on the command line
11 years ago
Katrina Owen
ce737fe01e
Fix typo in godoc for Float64
11 years ago
Jeremy Saenz
7be170c042
Added godoc for Float64
11 years ago
Katrina Owen
2ec51afe91
Implement Float64Flag. See #46
11 years ago
Jeremy Saenz
a4d75ab69e
Moved some code around in context.go
11 years ago
Jeremy Saenz
01b889e637
Merge branch 'master' of github.com:xyproto/cli into xyproto-master
...
Conflicts:
app.go
context.go
11 years ago
Alexander Rødseth
1bea6dcbf0
Custom type for arguments
11 years ago
Jeremy Saenz
ab6f1b7c3c
Formatting
11 years ago
Jeremy Saenz
4120b604ec
Removed help flag. we no longer need it.
11 years ago
Jared Forsyth
dc8a62e0e9
refactor, more robust flag propagation
11 years ago
Jared Forsyth
73e88630a5
fmt
11 years ago
Jared Forsyth
ccb1528bb0
adding multi-named flags
11 years ago
Alexander Rødseth
30d83a70a7
Added two convenience functions for retrieving arguments
11 years ago
Jeremy Saenz
0d3c3f4497
Improved documentation
11 years ago
Thesyncim
ed96efff1b
add simple test , fix errors and unused interface SliceFlag
11 years ago
Thesyncim
4d9038a156
add ability to parse []string types
11 years ago
Jeremy Saenz
70eacca641
JMS #25 : Added support for help flags
11 years ago
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
11 years ago
Jeremy Saenz
6664835bc1
JMS #14 : Moving toward having and app object
11 years ago
Jeremy Saenz
59b0ce24ef
JMS #4 : Support for global flags in cli.Context
11 years ago
Jeremy Saenz
3f76896c4f
JMS #4 : Getting some cli tests going. Testing out flags
11 years ago
Jeremy Saenz
ff4e064e21
JMS #4 : Formatting
11 years ago
Jeremy Saenz
6f22315082
JMS #4 : Parsing command flags with context
11 years ago