Boost logo

Boost Users :

Subject: [Boost-users] [program_options] Obtaining parameter order
From: Adam Nielsen (a.nielsen_at_[hidden])
Date: 2009-04-05 00:35:11


Hi everyone,

I'm writing a program that needs to know the order that parameters are
supplied in, but I can't find anything in the docs about this.

For example, a program to work with .zip files might work like this:

 zip --rename=one.bin:alpha.bin --add=one.bin --rename=one.bin:beta.bin

The initial --rename would need to be acted upon first, before --add
(otherwise one.bin would get overwritten) and likewise the last --rename must
be acted upon after --add, otherwise the wrong file (or no file) would be
renamed. If I use normal string vectors the order of the parameters will be
lost so this won't work.

Is this sort of parsing possible with program_options, or will I need to
resort to writing my own command-line parsing code?

Thanks,
Adam.


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