Open ikedam opened 2 years ago
FlagSet.ParseErrorsWhitelist.UnknownFlags ignores unknown flags, but throws away them. I want pflag just skip them and pass them to Args().
FlagSet.ParseErrorsWhitelist.UnknownFlags
pflag
Args()
Input:
--known-flag known-flag-value --unknown-flag arg0 arg1 arg2
Current output via Args():
arg1 arg2
arg0 is treated as value for unknown-flag-value
Wanted output via Args():
--unknown-flag arg0 arg1 arg2
Background: I want to create a utility wrapper for existing command. It accepts extra flags and change how to call the command. It's used like this:
mygrep --my-extra-flag1 --my-extra-flag2 my-extra-flag2-value -i -e search-text file1 file2
This is a nice-to-have feature. I'm wondering why no one is reviewing this
FlagSet.ParseErrorsWhitelist.UnknownFlags
ignores unknown flags, but throws away them. I wantpflag
just skip them and pass them toArgs()
.Input:
Current output via
Args()
:arg0 is treated as value for unknown-flag-value
Wanted output via
Args()
:Background: I want to create a utility wrapper for existing command. It accepts extra flags and change how to call the command. It's used like this: