$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: Guy Peled (GPeled_at_[hidden])
Date: 2006-01-05 20:12:19
Okay, I finally found out the missing part. In case someone else is looking for the same info, here's my finding:
 
There's additional flags that can be used to control this behavior, specifically the command_line_style::style_t::allow_long_disguise is the one that will make single dash options work exactly like double-dash. 
Here's an example :
    namespace po = boost::program_options;
    po::command_line_style::style_t style = po::command_line_style::style_t(
        po::command_line_style::unix_style | 
        po::command_line_style::case_insensitive | 
        po::command_line_style::allow_long_disguise );
        string inputFilename;
        string statelessTeslaMethodsFilename;
        string strConfigFile;
        po::options_description desc2;
        desc2.add_options()
            ( "config-file", po::value< std::string >( & strConfigFile )->default_value( "jaja" ) );
        po::variables_map vm2;
        po::store(po::parse_command_line(argc, argv, desc2, style ), vm2);
        po::notify(vm2);    
Enjoy,
Guy.
________________________________
From: Guy Peled 
Sent: Thursday, January 05, 2006 9:15 AM
To: 'boost-users_at_[hidden]'
Subject: RE: [Boost-users] [Boost.Program_options] Is there a way to havealloptions specifiedwith a single dash instead of double?
Hmmm...I must be missing something very obvious. 
Trying your example, I still don't seem to be able to use -config-file, but only --config-file.
 
Here's my code snippet:
string strConfigFile;
po::options_description desc2;
desc2.add_options()
    ( "config-file", po::value< std::string >( & strConfigFile )->default_value( "jaja" ) );
po::variables_map vm2;
po::store(po::parse_command_line(argc, argv, desc2), vm2);
po::notify(vm2); 
And this is accepted fine:
--config-file foo
While this throws an 'unkown option -c':
-config-file foo
Any insights into what may be causing such a difference in behaviot?
Thanks
Guy,
 
________________________________
From: boost-users-bounces_at_[hidden] [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Alexandre Gacon
Sent: Thursday, January 05, 2006 8:46 AM
To: boost-users_at_[hidden]
Subject: Re: [Boost-users] [Boost.Program_options] Is there a way to havealloptions specifiedwith a single dash instead of double?
No, all the args start with a single '-'.
 
For example, with the following code:
 
    po::options_description desc;
    desc.add_options()
        ( "config-file", po::value< std::string >( & strConfigFile )->default_value( defaultConfigFilePath.native_file_string() ) );
 
I am able to call my program with a -config-file my_config_file.cfg command line.
 
Alexandre
 
________________________________
De : boost-users-bounces_at_[hidden] [mailto:boost-users-bounces_at_[hidden]] De la part de Guy Peled
Envoyé : jeudi 5 janvier 2006 17:21
À : boost-users_at_[hidden]
Objet : [Boost-users] [Boost.Program_options] Is there a way to have alloptions specifiedwith a single dash instead of double?
 
I'm interested in switching over the command line processing of an existing tool to use program_options.
However, all of the args are of the format '-foo -bar -whatever 1' etc.
As far as I can tell from the docs it seems like by default the program_options library assumes args all start with a '--' or have single character short names that start with a single dash. Is there a way to coerce it into the behavior I'm looking for?
Thanks for any tips!
Guy. 
 
_________________________________________________________________ 
Guy Peled       Email gpeled_at_[hidden] 
3D/Tools Architect      408-486-2505 
nVIDIA  2701 San Tomas Expressway 
www.nvidia.com <file:///\\www.nvidia.com>   Santa Clara, CA 95050 
_________________________________________________________________