Reputation: 4516
I'm currently writing a wrapper around git diff
, and it would be nice if any flag that wasn't immediately relevant to my program would be passed through to git diff
. So for example:
my-tool
eventually runs git diff
my-tool --dir
eventually runs git diff --dir
I'm using the flag
package for parsing command line flags, however, and it looks like there's no option to collect unrecognised flags. I've also investigated the pflag
package, which has the ability to keep running when encountering an unknown flag, but doesn't appear to offer a way to collect these unrecognised flags.
My question is -- is there a way of parsing flags that also allows collection of unrecognised flags, short of copying one of these implementations and modifying it?
Upvotes: 1
Views: 516
Reputation: 42413
[I]s there a way of parsing flags that also allows collection of unrecognised flags, short of copying one of these implementations and modifying it?
No.
Upvotes: 1