Fabian Tamp
Fabian Tamp

Reputation: 4516

Is there a way of catching all unrecognised command line flags using Go's `flag` package?

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:

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

Answers (1)

Volker
Volker

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

Related Questions