aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2015-08-05Merge pull request #37 from eparis/ip-testsEric Paris
Two New Flag Types - IPNet and Count
2015-08-05New counter flag typeEric Paris
``` -vvv ``` Will give a value of 3 ``` -v=4 -v ``` Will give a value of 5
2015-08-05Add new net.IPNet flag typeEric Paris
2015-08-05Add _test for the net.IP flag typeEric Paris
2015-08-05Merge pull request #36 from eparis/empty-slicesEric Paris
Empty slices should be empty - not length 1 with an empty string
2015-08-05Do not include \n in Errorf outputEric Paris
2015-08-05Empty slices should be empty, not have a single (empty) stringEric Paris
2015-08-05Merge pull request #35 from eparis/slice-multi-callEric Paris
String and Int slices called twice should append not overwrite
2015-08-05String and Int slices called twice should append not overwriteEric Paris
This allows users to do things like ``` cmd --filename=file1 --filename=file2 --filename=file3,file4 ``` And internally we will get ``` []string{"file1", "file2", "file3", "file4"} ```
2015-08-05Merge pull request #34 from eparis/slice-show-bracketEric Paris
Show [] around string slices when showing the text
2015-08-05Show [] around string slices when showing the textEric Paris
This means things like autogenerated docs will show `--filename=[]` instead of just `--filename=`
2015-06-22Merge pull request #30 from eparis/docsEric Paris
docs
2015-06-22docsEric Paris
2015-06-22Merge pull request #20 from eparis/optional-argsEric Paris
Fix '--flag arg' and Allow flags to take optional arguments
2015-06-22Add support for '--flag arg'Eric Paris
2015-06-22Set default values if no arg givenEric Paris
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