|
Boost Users : |
Subject: [Boost-users] [program_options] detecting if "arguments" are passed
From: Christoph Duelli (duelli_at_[hidden])
Date: 2009-07-28 09:35:18
I am using Boost.ProgramOptions to parse my command line options.
By default, I an exception is thrown when an unknown option is passed. So
far, so good.
Suppose I have a program p that takes only the option --help - and nothing
else, esp. not a "positional option" or "arguments".
I.e. I would like to croak a message to the user if she call something like
p /tmp/x
ProgramOptions does croak when I call "p -v", but not when I call
"p /tmp/x".
Question:
What is the recommended way to catch unwanted (or forbidden) arguments (not
options!)?
(I know I can define a positional like --input-file and then check if any of
those are present. But that seems quite awkward for such a "simple" thing.)
Best regards
Christoph
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net