[Home]Add Options Should Be Able To Parse Arguments - Program Options Suggestion

BOOST WIKI | RecentChanges | Preferences | Page List | Links List

Difference (from prior major revision) (no other diffs)

Removed: 92,145d91

![ photos free chicks with hot dicks KCzui | http://smisla.zenno.info/2005/www/freesites/hot-chicks-with-dicks-photos-free.html ]
![ trannies chubby UHICh | http://smisla.zenno.info/2005/www/freesites/chubby-trannies.html ]
![ interracial debate bZPVQ | http://jopik.zenno.info/edit/wakka/new/interracial-debate.html ]
![ movies hardcore shemale hquYw | http://smisla.zenno.info/2005/www/freesites/shemale-hardcore-movies.html ]
![ women shitting jfwWM | http://jopik.zenno.info/edit/wakka/terem/women-shitting.html ]
![ women nude pics of mature bKCGo | http://smisla.zenno.info/2005/www/cunt/pics-of-mature-women-nude.html ]
![ of hormones feminizing the feminization transsexual kPAcJ? | http://smisla.zenno.info/2005/www/freesites/feminizing-hormones-feminization-of-the-transsexual.html ]
![ mature sex women with ugQDF | http://jopik.zenno.info/edit/wakka/terem/sex-with-mature-women.html ]
![ asian tpg IgtNO? | http://maxima.zenno.info/prik/googl/new/asian-tpg.html ]
![ girls asian thongs in tSgKZ? | http://maxima.zenno.info/prik/googl/new/asian-girls-in-thongs.html ]
![ human hermaphrodite GfxjY? | http://smisla.zenno.info/2005/www/freesites/hermaphrodite-human.html ]
![ mature guys fucking younger women KHDRw | http://smisla.zenno.info/2005/www/cunt/mature-women-fucking-younger-guys.html ]
![ free shemale thumbnails eVSOv | http://smisla.zenno.info/2005/www/freesites/shemale-free-thumbnails.html ]
![ idols asian PROog | http://maxima.zenno.info/prik/googl/new/asian-idols.html ]
![ gallery hermaphrodite free pics UHAbp | http://smisla.zenno.info/2005/www/freesites/hermaphrodite-gallery-pics-free.html ]
![ free tranny fat galleries BZWPa | http://smisla.zenno.info/2005/www/freesites/free-fat-tranny-galleries.html ]
![ old tgp tits mature nrgpF | http://smisla.zenno.info/2005/www/cunt/mature-old-tits-tgp.html ]
![ old nylons ladies mature pantyhose pIPuk | http://jopik.zenno.info/edit/wakka/terem/mature-old-ladies-pantyhose-nylons.html ]
![ beautiful shemale sUgzR? | http://smisla.zenno.info/2005/www/freesites/beautiful-shemale.html ]
![ cumshot amateur pics free RbjyS? | http://maxima.zenno.info/prik/googl/kajf/free-amateur-cumshot-pics.html ]
![ porn mature mom bxigr | http://jopik.zenno.info/edit/wakka/terem/mom-mature-porn.html ]
![ galleries free fetish mature uSDrP? | http://smisla.zenno.info/2005/www/cunt/free-mature-fetish-galleries.html ]
![ young lesbian sample videos ZFuca | http://smisla.zenno.info/2005/www/skut/young-lesbian-sample-videos.html ]
![ schoolgirl asian bondage xiEMB | http://maxima.zenno.info/prik/googl/new/asian-schoolgirl-bondage.html ]
![ geile girls DfnwP? | http://maxima.zenno.info/prik/googl/new/geile-girls.html ]
![ vagina fisting sYxPO? | http://maxima.zenno.info/prik/googl/morok/vagina-fisting.html ]
![ women strong hairy SflBw? | http://smisla.zenno.info/2005/www/tup/strong-hairy-women.html ]
![ women politics in QnXNw? | http://smisla.zenno.info/2005/www/cunt/women-in-politics.html ]
![ mature tgp passion MXGtx | http://smisla.zenno.info/2005/www/cunt/mature-passion-tgp.html ]
![ free xxx sex pictures asian JBpUF? | http://maxima.zenno.info/prik/googl/new/free-asian-sex-xxx-pictures.html ]
![ mature non photos nude free oGAKv | http://jopik.zenno.info/edit/wakka/terem/free-mature-non-nude-photos.html ]
![ mature hairy ladies DWxaC? | http://smisla.zenno.info/2005/www/cunt/mature-ladies-hairy.html ]
![ porn mature tgp free JoQBr? | http://jopik.zenno.info/edit/wakka/terem/free-mature-porn-tgp.html ]
![ sex chat she male cyber yFNkg | http://jopik.zenno.info/edit/wakka/skuns/she-male-cyber-sex-chat.html ]
![ monsters lucky dogfart NPoRC? | http://jopik.zenno.info/edit/wakka/new/dogfart-lucky-monsters.html ]
![ asian video hardcore sample wFozG? | http://maxima.zenno.info/prik/googl/new/asian-hardcore-sample-video.html ]
![ porn ool interracial NoEVb? | http://jopik.zenno.info/edit/wakka/new/ool-interracial-porn.html ]
![ porn mature email in free wqKXD | http://smisla.zenno.info/2005/www/cunt/free-mature-porn-in-email.html ]
![ videos pussy lesbian free suck my ewNzG? | http://smisla.zenno.info/2005/www/skut/lesbian-free-suck-my-pussy-videos.html ]
![ real sex hermaphrodite HfkKU? | http://jopik.zenno.info/edit/wakka/skuns/hermaphrodite-sex-real.html ]
![ mature celebrity nude EdGWz? | http://smisla.zenno.info/2005/www/cunt/celebrity-mature-nude.html ]
![ fucking anal latina LfIAv? | http://maxima.zenno.info/prik/googl/morok/latina-anal-fucking.html ]
![ pictures japanese free mature LqCGW? | http://smisla.zenno.info/2005/www/cunt/free-japanese-mature-pictures.html ]
![ gallery sex nurse njJpH? | http://smisla.zenno.info/2005/www/cunt/nurse-sex-gallery.html ]
![ gay arse teens rimming oEhbP? | http://maxima.zenno.info/prik/googl/morok/gay-teens-rimming-arse.html ]
![ 3 mature xxx day trials DMLzK? | http://smisla.zenno.info/2005/www/cunt/xxx-3-day-trials-mature.html ]
![ mpeg black blonde dogfart JBjfH? | http://jopik.zenno.info/edit/wakka/new/black-blonde-dogfart-mpeg.html ]
![ asian free porn cute ladyboy trannies NKCMR | http://maxima.zenno.info/prik/googl/new/free-porn-cute-ladyboy-asian-trannies.html ]
![ with chicks video dicks HCPLk | http://jopik.zenno.info/edit/wakka/skuns/chicks-with-dicks-video.html ]
![ cum public shots HnGwT? | http://maxima.zenno.info/prik/googl/kajf/public-cum-shots.html ]
![ granny mature Hardcore galleries XTvbq | http://jopik.zenno.info/edit/wakka/terem/Hardcore-mature-granny-galleries.html ]
![ transsexual young iBaIf? | http://jopik.zenno.info/edit/wakka/skuns/young-transsexual.html ]
zDTwGFJXlcIRiQB?

add_options() should be able to parse arguments (also, implement %args%)

Back to Suggestions - program options library


It should be possible to parse arguments in the same way as regular command-line options, perhaps with an empty command string:

        desc.add_options()
        ("", parameter<int>("value", &magic), "<magicValue>")
        ;

Or maybe better, with a symbol, like:

        (cmdline_arg, parameter<int>("value", &magic), "<magicValue>")

For one thing, it would yield a consistent interface. As it is, the only way to access the arguments is through arguments(), e.g.:

        po::options_and_arguments opts = po::parse_command_line(ac, av, desc);
        ...
        copy(opts.arguments().begin(), opts.arguments().end(),
             ostream_iterator<string>(cout, "\n   "));

What if my argument is an int? Or a vector of ints? It would be nice if argument parsing had access to the powerful facilities provided for commandline options.

(Or, if it already does -- then add a corresponding example to the sample code).

Another advantage would be to consolidate error processing. You'd typically do:

    try {
        desc.add_options()
            ...
            ;

        ...
    } catch (exception& e) {
        // Process errors
    }

What to do if you find an error in the commandline arguments? I suppose you could always throw one of program_option's exceptions. But it would be more natural for the program_option lib to do this for you.

Another benefit is that it could simplify maintaining a correct usage message (assuming another new feature). You could have:

    options_description desc("Usage: %progname% %args% OPTIONS\n"
                             "        OPTIONS");

Here, %progname% gets replaced by the unadorned program name -- path stripped off, no .exe on Windows, and lowercase on Windows. Then, %args% gets replaced by the arguments string -- in this case, "<magicValue>". So, we'd have:

    Usage: someprogram <magicValue> OPTIONS
            OPTIONS:
        -o Option 1: some option
        -p Option 2: some other option

    - People/Chuck Messenger


I need to consider how to implement this. I see some appeal in idea that arguments are validated by the same code, but since in my practice arguments are almost always file name, I did not feel this to be very important.

    - People/Vladimir Prus


In my practice, args are sometimes numbers - either integer or floating point. In general, they could be any value which an option might be.

    - People/Chuck Messenger


Ok, I understand your motivation. Need to design an approach.

   - People/Vladimir Prus


If have ever used Perl's Getopt::Long you have seen how powerful it is. Being able to use vectors or even callback functions to collect command line args is really simple. Would that sort of thing be possible?

   - People/Caleb Epstein

BOOST WIKI | RecentChanges | Preferences | Page List | Links List
Edit text of this page | View other revisions
Last edited October 12, 2005 5:19 am (diff)
Search:
Disclaimer: This site not officially maintained by Boost Developers