| Age | Commit message (Collapse) | Author |
|
Now in usage shows flag.Value.Type() instead of flag.Value.(type), what makes library more flexible
|
|
Fix string_slice with empty value
|
|
Currently, if you don't set any value for a StringSliceVar, it will
end-up failing with an EOF error. It fails because the CSV parser for
the value can't read anything.
Special case when the string is empty to return an empty list.
|
|
|
|
|
|
Document AddGoFlagSet method in the README file
|
|
|
|
|
|
|
|
Add simple method to see if a flagset has available flags
|
|
With the hidden and deprecated fields, it is useful to be able
to ask if a flagset has any non-hdden, non-deprecated flags.
One example of this is to aid in writing help templates.
|
|
Remove go 1.3 and 1.4 from travis; add 1.6
|
|
Due to the age of 1.3 and 1.4, removing them from travis. They
currently are incompatible with golint as well, meaning that we,
otherwise, need to remove golint in testing.
|
|
Compare to 1.4, the main difference in formatting is
the placement of default values. Moreover, UnquoteUsage()
is now added (and exported, for full API compatibility
with the standard flag package), so backtick words in
usage messages can be used to set the placeholder name.
Compared to the standard flag package, this patch
always prints usage in one-line, with automatic
alignment, because I feel that the 1.4 output is very
confusing when modified to include also dash-dash flags.
|
|
In golang flags -bob and --bob are the same thing. Not so in pflags. But
when a golang flag was just -b or --b we would still only support --b.
This was a little awkward to users.
If a golang flag was declared as a single character, support both the -b
and --b versions in the pflag version.
|
|
Use encoding/csv to parse string slices
|
|
|
|
There was no way to escape or use a , in a string slice so use the
encoding/csv library, rather than string.split() and let golang take
care of the encoding issues.
|
|
Add more CI checks forcing code cleanliness
|
|
|
|
Store the length of Args when a -- is found in commandline
|
|
This allows a program to know what args came before the -- and what args
came after.
|
|
private flags
|
|
removing some c/p left-overs from the MarkPrivate function, and updating the comment slightly
changed field from Private to Hidden. Added documentation w/example to README.md. Added testing to confirm hidden flags
updating test message
|
|
Add shorthand deprecator
|
|
|
|
Do not trust golang flag's DefValue
|
|
Apparently it is wrong :-(. Use the current value instead. It is at
least the default at the moment that pflag learned about the flag.
|
|
Support merging golang flags into pflags
|
|
They aren't "perfect". spf13/pflag chose to use an explicit `Type` in the
value. golang has nothing of the sort and has a rather crazy
IsBoolFlag() bit of nonsense for the one case that really makes sense to
have the explicit `Type`. Probably because adding interfaces really screws
people up. So supporting golang flags in pflags isn't super super
simple, we need to figure out how to handle our `Type` given only the
information available in a golang flag. This does it as best we can with
`reflect`.
|
|
New AddFlagSet function on FlagSet
|
|
This function allows one to create a different FlagSets and then easily
merge them together.
|
|
Use Type() instead of internal .(*stringValue)
|
|
This makes things easier to read/understand and it also means that users
who declare their own flags and call them "string" will get quotes as
well.
|
|
Fix up minor things found by goreportcard.com
|
|
Reduce code duplication in PrintDefaults/FlagUsages
|
|
They both did the same thing. So use one in the other.
|
|
|
|
Display which flags are optional flags in usageFunc
|
|
|
|
Fix a couple typos.
|
|
|
|
Do not append to default values in {String,Int}Slice
|
|
Fix typo in bool_test.go
|
|
(cherry picked from commit faf06f062514fcb3a92c325d15bf312d1be84f94)
|
|
I added the ability to do: `-s=bob -s=john` and get `[]string{"bob", "john"}`
But if a default value was set to say `[]string{"eric"}` the above
operation was mistakenly resulting in: `[]string{"eric", "bob", "john"}
which was obviously not what was intended.
This is fixed by tracking if a value was parsed and overwriting the
default on the first time -s is found, but we append the 2+ time.
|
|
More tests for Changed
|
|
|
|
New helper to easily see if a flag has been set
|
|
A lot easier than having to do it in the user over and over and over.
|