aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2015-06-22Merge pull request #27 from eparis/SliceStringsEric Paris
Add new StringSlice and IntSlice flag types
2015-06-22Tests for GetIntSlice and GetStringSliceEric Paris
2015-06-22Much like stringSlice, add intSlice flag typeEric Paris
2015-06-22Add new StringSlice flag typeEric Paris
Arguments passed on the command line will be split on "," and will be stored in a slice. We can see this already exits in codegangsta/cli https://github.com/codegangsta/cli/blob/44d40054fa6208a3013d7217aca72a2b8b0f5a0b/flag.go#L102 And people have written their own implementations for cobra/pflag https://github.com/GoogleCloudPlatform/kubernetes/blob/c5ba95ee26cbec9694a780544b559a797956ea54/pkg/util/list.go Lets just make it a first class flag
2015-06-22Merge pull request #25 from eparis/GetFlagTypeEric Paris
Add new FlagSet.Get{Int,String,...} accessor functions
2015-06-22Merge pull request #29 from liggitt/set_annotationEric Paris
Add SetAnnotation helper
2015-06-22Add SetAnnotation helperJordan Liggitt
2015-06-01Add new FlagSet.Get{Int,String,...} accessor functionsEric Paris
If I declared a bool flag named "hello" I can now call b, err := f.GetBool("hello") And b will hold the value of the flag We can see this is already done in https://github.com/codegangsta/cli/blob/bcec9b08c7e5564f7512ad7e7b03778fe1923116/context.go If people use the codegangsta/cli Other projects have done it themselves using pflags (what inspired this patch) https://github.com/GoogleCloudPlatform/kubernetes/blob/cd817aebd848facda29e0befbbd6e31bf22402e6/pkg/kubectl/cmd/util/helpers.go#L176 Lets just do it ourselves...
2015-06-01Merge pull request #26 from eparis/moar-testsEric Paris
Moar tests
2015-06-01Moar flag_test!Eric Paris
2015-06-01Remove Value.Get() interfacesEric Paris
These were only defined for a couple for flag types (ip, ipmask, uint16, uint32) and weren't used anywhere. If you already knew the type well enough to know that it was one of the few with a Get() interface, you could cast yourself out of the Value...
2015-05-27Merge pull request #24 from eparis/longArgCleanupEric Paris
Slight code cleanup parsing long flags
2015-05-27Slight code cleanup parsing long flagsEric Paris
2015-05-19Added a test for normalizing usage nameAnastasis Andronidis
[close #23]
2015-05-12Fixed statementAnastasis Andronidis
2015-05-12Normalization should change the nameAnastasis Andronidis
2015-05-10Merge pull request #22 from andronat/multiple_narmalization_requestsEric Paris
Call normalizeFlagName function only once
2015-05-10Call normalizeFlagName function only onceAnastasis Andronidis
2015-05-08Merge pull request #21 from eparis/bool-equal-fixEric Paris
Support bool= with shortnames
2015-05-08Support bool= with shortnamesEric Paris
Currently a shortname bool variable b cannot use the -b=true -b=false form because the -b is assumed to mean true and the = format is never noticed.
2015-05-08Merge pull request #19 from eparis/parse-reworkBjørn Erik Pedersen
Parse rework
2015-05-08Rewrite short arg parsing for readabilityEric Paris
new function to parse each arg (less indentation) make it clear what value is being set and where it came from
2015-05-08parseLongArg code rework for readabilityEric Paris
move the -- parsing up into the parent make it more obvious which values we are using
2015-05-01Merge pull request #16 from eparis/mergeSteve Francia
Merge ogier/pflag and enable travis
2015-04-29Merge pull request #17 from eparis/NormalizeFuncReadmeEric Paris
Add docs and examples how to use the flag normalization func
2015-04-29Add docs and examples how to use the flag normalization funcEric Paris
2015-04-29Update travis for spf13Eric Paris
2015-04-29Merge remote-tracking branch 'ogier/master' into mergeEric Paris
Conflicts: bool_test.go flag.go flag_test.go
2015-04-28Merge pull request #15 from eparis/generic-flag-normalization-thockinEric Paris
Generic flag normalization
2015-04-28Custom normalization funcEric Paris
This can be used however you want. My test is for flag aliases
2015-04-28Make normalizedName external so we can make the functions externalEric Paris
2015-04-28Merge pull request #9 from eparis/deprecated-flagEric Paris
Ability to mark flags as deprecated
2015-04-28Ability to mark flags as deprecatedEric Paris
They will not show up in usage or help, but they will still work. The usage message will print on os.Stderr any time the flag is set.
2015-04-27Merge pull request #10 from eparis/declare_by_nameEric Paris
Declare Flag{ by name instead of order
2015-04-27Merge pull request #12 from fabianofranz/masterEric Paris
Add support to short form with equal sign: -p=value
2015-04-27Merge pull request #13 from thockin/dash-under-equivEric Paris
Allow WordSeparators to be set after flags are added
2015-04-23Allow WordSeparators to be set after flags are addedTim Hockin
2015-04-24Allow flag name normalization for compareTim Hockin
This allows the FlagSet to define equivalent word-separators. Given this, one can make - and _ equivalent, so --foo-bar and --foo_bar both work.
2015-04-22Add support to short form with equal sign: -p=valuefabianofranz
2015-04-07Declare Flag{ by name instead of orderEric Paris
In order to be able to add new (unitialized) fields to Flags{} declare fields by name instead of order
2015-04-01add annotations for flagsEric Paris
cobra.Command can make use of annotation in order to generate better bash_completions
2015-03-12Always return when err is not nil.Brendan Burns
2015-02-17Merge pull request #5 from ncdc/fix-double-dash-terminationFilipe Brandenburger
Fix handling of -- termination
2015-02-17Fix handling of -- terminationAndy Goldstein
Fix handling of -- termination. Previously, if you ran $command -flag1 -etc -- some args after the command's args would be doubled (some args after some args after). Additionally, if there were items after the -- termination that looked like flags, the parser would throw an error. It's better to terminate parsing when -- is seen, because that usually indicates the caller wants to pass the remainder of the arguments (including flags) as-is to something else.
2015-02-15Add Travis build status marker to READMEAlex Ogier
2015-02-14Move test files to the 'pflag' packageAlex Ogier
This means we can avoid putting the repository name into the source files, so people who have their own forks don't have to make changes.
2015-02-15Merge pull request #15 from ogier/enable_travis_ciAlex Ogier
Add .travis.yml file
2015-02-14Add .travis.yml fileAlex Ogier
2015-02-14Fixed noisy test case for the new boolFlagAlex Ogier
2015-01-22Merge pull request #3 from filbranden/bool_value_for_spf13Filipe Brandenburger
Bool value for spf13