0

I'm using google flags for command line parsing. It's a wonderful tool, but somehow I need it to ignore unknown flags instead of print a line of

ERROR: unknown command line flag ...

Is there anyway to do it?

Ralph Zhang
  • 5,015
  • 5
  • 30
  • 40

3 Answers3

2

"--someflag1=1 --someflags2=4 --undefok=someflag1,someflag2" will cause no error if someflag1 or someflag2 is not defined. However, if they are defined then they would get values define in commandline.

0

If you use a flagfile , unrecognised flags are ignored.

Peter Wood
  • 23,859
  • 5
  • 60
  • 99
0

As you can see in Google Flags' source code for CommandLineFlagParser, it does its parsing in 2 stages: stage 1 is parsing anything that looks like a flag, and if it doesn't know what to do with it, it is stored for error report afterward. There is no option to change that behaviour.

Nowhere man
  • 5,007
  • 3
  • 28
  • 44