Does the Poco C++ Library Support positional command line arguments?
-
02-10-2019 - |
Question
I can see no way to support positional command line arguments with Poco's Poco::Util::Application
class and related Poco::Util::OptionProcessor
. Positional arguments are unnamed arguments on the command line, coming at the end after all other options, as such:
someprogram -b --what=121 filename.bin
In that example, filename.bin is a positional argument, it has no name, but is the first positional argument after all named arguments. Boost's program_options supports this, and I find it hard to believe Poco does not, but I can't discover how to support it given the source and documentation.
Does Poco support this?
Solution
I'm not familiar with Poco, but looking at the documentation, I suspect that the intended usage is to repeatedly call Poco::Util::OptionProcessor::process()
on successive elements of argv
until it returns false
, and that would then signify the start of positional arguments and let you handle them however you wish.