|
Boost Users : |
Subject: Re: [Boost-users] Program Options.. Specifying "-e" as an option value.....
From: Diederick C. Niehorster (dcnieho_at_[hidden])
Date: 2010-10-07 21:17:08
I don't know too much about the library, but see that i your code you
use a capital E. See if there is a way to turn on
case-insensitiveness, or change it to what you want it to be.
Best,
Dee
On Fri, Oct 8, 2010 at 06:19, <david.weber_at_[hidden]> wrote:
> I have an application, which spawns off other applications. As input, it
> takes in environment variables and arguments to pass to the resultant
> application. For instance:
>
>
>
>
>
> mutate -E âenv_var1=valâ -a â.â ls
>
>
>
> This will run:
>
>
>
> ls .
>
>
>
> and the environment will only have âenv_var1â equal to âvalâ
>
>
>
>
>
> So. Something funny comes along when I try to pass â-eâ as an argument.
>
>
>
> So, in the above would be:
>
>
>
> mutate -a â-eâ âa âfooâ xterm
>
>
>
> The program options parser attempts to parse the â-eâ, and says âI donât
> know what it isâ.
>
>
>
> Any thoughts on having it skip that option?
>
>
>
>
>
> Code Snippits:
>
>
>
>
>
> Â Â Â po::options_description visible("Program options. Usage %1%");
>
> Â Â Â visible.add_options()
>
> Â Â Â Â Â Â Â ("env,E", po::value<string_vector_t>(), "Specify an environment
> variable to run the executable with. In the form of foo=bar")
>
> Â Â Â Â Â Â Â ("arg,a", po::value<string_vector_t>(), "Specify a command line
> argument to pass to the executable")
>
> Â Â Â ;
>
>
>
> Â Â Â // Set up some hidden options
>
> Â Â Â po::options_description hidden("Hidden options");
>
> Â Â Â hidden.add_options()
>
> Â Â Â Â Â Â Â ("executable", po::value < std::string>(), "the executable to run")
>
> Â Â Â ;
>
>
>
>    // Set up positional arguments. They are going to be execute
>
> Â Â Â po::positional_options_description pos;
>
> Â Â Â pos.add("executable", 1);Â Â Â Â Â // There can only be 1 item executed
>
>
>
> Â Â Â // Consolidate all the options into a single one
>
> Â Â Â po::options_description all_options("All Options");
>
> Â Â Â all_options.add(visible);
>
> Â Â Â all_options.add(hidden);
>
>
>
> Â Â Â // Parse the command line options
>
> Â Â Â po::store(po::command_line_parser(argc,
> argv).options(all_options).positional(pos).run(), vm);
>
> Â Â Â po::notify(vm);
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
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