Boost logo

Boost Users :

Subject: [Boost-users] Boost Program Options Optional Value (request for implicit_value() behaviour change to allow space)
From: Andrei LIHU (andrei.lihu_at_[hidden])
Date: 2008-10-08 05:23:29


Description of the real problem:
- let "-b" be the name of the option
- it disables, if not present in command line, the general app logging
- it enables, if present in command line, the general app logging in a
default chosen logfile
- it enables, if present in command line with a string argument, the
general app logging into the file specified as string argument

Usage example:
>> program_name (no logging)
>> program_name -b (logging enabled; goes to logfile.log)
>> program_name -b "C:\otherlogfile.log" (logs where specified)

So far I found a solution based on implicit_value() behaviour, with
"-b" of type string, but my main problem is that in this case I am
forced to enter the value to be adjacent to "-b" (e.g.
-b"C:\otherlogfile.log"). The desired form would be the one with a
space between, in order to maintain our backward compatibility of
scripts (e.g: -b "C:\otherlogfile.log").

Can you help me with a good solution? (Even solutions that crack into
the source of boost program options library are appreciated.)

Thank you for your time.

-- 
Kind regards,
Andrei LIHU
--------------------
softNRG
C++ Software Developer
+40742545392

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