Boost.Program_options: Parsing arguments like "+a" possible?
Hello, is it possible to parse also arguments like "+a" with the library "Boost.Program_options"? The numbers of arguments are simple to much to use only the "-" or the "--" as a sign for arguments. If it possible, how have I to activate this function? Thank you. -- Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de
What do you mean with the number of arguments is too much? do you want
+a do have a different meaning than -a?
I don't think thats possible...
Best,
Dee
On Mon, Aug 8, 2011 at 09:15,
Hello,
is it possible to parse also arguments like "+a" with the library "Boost.Program_options"? The numbers of arguments are simple to much to use only the "-" or the "--" as a sign for arguments.
If it possible, how have I to activate this function?
Thank you.
-- Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
If the number of arguments is too much, I suggest you to use configuration
file (.ini file),
which is also supported by this library.
On Mon, Aug 8, 2011 at 14:18, Diederick C. Niehorster
What do you mean with the number of arguments is too much? do you want +a do have a different meaning than -a?
I don't think thats possible...
Best, Dee
On Mon, Aug 8, 2011 at 09:15,
wrote: Hello,
is it possible to parse also arguments like "+a" with the library "Boost.Program_options"? The numbers of arguments are simple to much to use only the "-" or the "--" as a sign for arguments.
If it possible, how have I to activate this function?
Thank you.
-- Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Am 08.08.2011 08:18, schrieb Diederick C. Niehorster:
What do you mean with the number of arguments is too much? do you want +a do have a different meaning than -a?
I don't think thats possible...
Best, Dee
On Mon, Aug 8, 2011 at 09:15,
wrote: Hello,
is it possible to parse also arguments like "+a" with the library "Boost.Program_options"? The numbers of arguments are simple to much to use only the "-" or the "--" as a sign for arguments.
If it possible, how have I to activate this function?
Thank you.
-- Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Yes, your interpretation is right. The meaning of +a should be different of -a. myapp -a returns as example "Hello world" and myapp +a should return "Hello Boost community!". If it not possible to use boost.program_options, is it the best solution to build the own parser with boost.qi rules? Thanks.
Hi, I still do not understand what are you meaning with "too many options". Obviously, you can not intend "too many to remember by the user", otherwise using a '+' would not solve your problem. If you where limited to using '-' options, as in stadard posix getopt function, then you could obviously run out of characters to use, more so if you want the character to be meaningful (as -v for 'verbose' or -o for 'output'). But '--' options are _long_ options, meaning that you could write --verbose or --output. How could you possibly run out of names for your options? -- Leo Cacciari Aliae nationes servitutem pati possunt populi romani est propria libertas
Am 08.08.2011 12:35, schrieb Leo Cacciari:
Hi, I still do not understand what are you meaning with "too many options". Obviously, you can not intend "too many to remember by the user", otherwise using a '+' would not solve your problem.
If you where limited to using '-' options, as in stadard posix getopt function, then you could obviously run out of characters to use, more so if you want the character to be meaningful (as -v for 'verbose' or -o for 'output'). But '--' options are _long_ options, meaning that you could write --verbose or --output. How could you possibly run out of names for your options?
Hello, the app is grown up step by step and a other person has taken the decission to use the "+" as a sign for an argument. (All the letters for the - are used.) My task is more or less to rewrite the old case() parser to a new one, possible based on boost.program_options, to get a clear structure. At the moment I'm not very interesting to change the argument style, because all the example and more has also to be change to the new style.
Il 08/08/2011 12:47 PM, boost_mailinglist@gmx.de ha scritto:
Hello,
the app is grown up step by step and a other person has taken the decission to use the "+" as a sign for an argument. (All the letters for the - are used.) My task is more or less to rewrite the old case() parser to a new one, possible based on boost.program_options, to get a clear structure. At the moment I'm not very interesting to change the argument style, because all the example and more has also to be change to the new style.
Well then I believe you're out of luck. AFAIK and as is stated in the library documentation, start character for short options is - or / (the latter to conform to windows usage). -- Leo Cacciari Aliae nationes servitutem pati possunt populi romani est propria libertas
Am 08.08.2011 12:52, schrieb Leo Cacciari:
Il 08/08/2011 12:47 PM, boost_mailinglist@gmx.de ha scritto:
Hello,
the app is grown up step by step and a other person has taken the decission to use the "+" as a sign for an argument. (All the letters for the - are used.) My task is more or less to rewrite the old case() parser to a new one, possible based on boost.program_options, to get a clear structure. At the moment I'm not very interesting to change the argument style, because all the example and more has also to be change to the new style.
Well then I believe you're out of luck. AFAIK and as is stated in the library documentation, start character for short options is - or / (the latter to conform to windows usage).
Is there a way to get the library "patched" and replace the / through +? The app will only be used under linux. Thanks
You'll have to read through the source code (which isn't straight
forward). There will be a parser somewhere (maybe its easiest to find
the right file by putting a breakpoint before a call to
program_options and stepping through till you're in the parser. Once
there, the change is probably pretty trivial. And if you can do it in
a nice configurable way with a user exposed setting, the maintainers
might accept a patch. Though I'm worried about how you are going to
internally distinguish the + and - options...
Best,
Dee
On Mon, Aug 8, 2011 at 19:10,
Am 08.08.2011 12:52, schrieb Leo Cacciari:
Il 08/08/2011 12:47 PM, boost_mailinglist@gmx.de ha scritto:
Hello,
the app is grown up step by step and a other person has taken the decission to use the "+" as a sign for an argument. (All the letters for the - are used.) My task is more or less to rewrite the old case() parser to a new one, possible based on boost.program_options, to get a clear structure. At the moment I'm not very interesting to change the argument style, because all the example and more has also to be change to the new style.
Well then I believe you're out of luck. AFAIK and as is stated in the library documentation, start character for short options is - or / (the latter to conform to windows usage).
Is there a way to get the library "patched" and replace the / through +? The app will only be used under linux.
Thanks _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Hey, do you think to create a own parser based on boost.qi is the best solution? Thanks Am 08.08.2011 13:15, schrieb Diederick C. Niehorster:
You'll have to read through the source code (which isn't straight forward). There will be a parser somewhere (maybe its easiest to find the right file by putting a breakpoint before a call to program_options and stepping through till you're in the parser. Once there, the change is probably pretty trivial. And if you can do it in a nice configurable way with a user exposed setting, the maintainers might accept a patch. Though I'm worried about how you are going to internally distinguish the + and - options...
Best, Dee
On Mon, Aug 8, 2011 at 19:10,
wrote: Am 08.08.2011 12:52, schrieb Leo Cacciari:
Il 08/08/2011 12:47 PM, boost_mailinglist@gmx.de ha scritto:
Hello,
the app is grown up step by step and a other person has taken the decission to use the "+" as a sign for an argument. (All the letters for the - are used.) My task is more or less to rewrite the old case() parser to a new one, possible based on boost.program_options, to get a clear structure. At the moment I'm not very interesting to change the argument style, because all the example and more has also to be change to the new style.
Well then I believe you're out of luck. AFAIK and as is stated in the library documentation, start character for short options is - or / (the latter to conform to windows usage).
Is there a way to get the library "patched" and replace the / through +? The app will only be used under linux.
Thanks _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
I'm not sure, if it seems easy for you, go for it!
But have a look at this:
http://www.boost.org/doc/libs/1_47_0/doc/html/program_options/howto.html#id2...
It might do the trick for you already, if you can change the plus into
some prefix or suffix that distinguishes it fomr the minus.
Best,
Dee
On Mon, Aug 8, 2011 at 19:36,
Hey,
do you think to create a own parser based on boost.qi is the best solution?
Thanks
Am 08.08.2011 13:15, schrieb Diederick C. Niehorster:
You'll have to read through the source code (which isn't straight forward). There will be a parser somewhere (maybe its easiest to find the right file by putting a breakpoint before a call to program_options and stepping through till you're in the parser. Once there, the change is probably pretty trivial. And if you can do it in a nice configurable way with a user exposed setting, the maintainers might accept a patch. Though I'm worried about how you are going to internally distinguish the + and - options...
Best, Dee
On Mon, Aug 8, 2011 at 19:10,
wrote: Am 08.08.2011 12:52, schrieb Leo Cacciari:
Il 08/08/2011 12:47 PM, boost_mailinglist@gmx.de ha scritto:
Hello,
the app is grown up step by step and a other person has taken the decission to use the "+" as a sign for an argument. (All the letters for the - are used.) My task is more or less to rewrite the old case() parser to a new one, possible based on boost.program_options, to get a clear structure. At the moment I'm not very interesting to change the argument style, because all the example and more has also to be change to the new style.
Well then I believe you're out of luck. AFAIK and as is stated in the library documentation, start character for short options is - or / (the latter to conform to windows usage).
Is there a way to get the library "patched" and replace the / through +? The app will only be used under linux.
Thanks _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Thank you for the good answer. It gives me the chance to create a new list of Arguments, all with a "-", without loosing the compatibly with the older "+" syntax. Thanks Am 08.08.2011 14:20, schrieb Diederick C. Niehorster:
I'm not sure, if it seems easy for you, go for it!
But have a look at this: http://www.boost.org/doc/libs/1_47_0/doc/html/program_options/howto.html#id2...
It might do the trick for you already, if you can change the plus into some prefix or suffix that distinguishes it fomr the minus.
Best, Dee
On Mon, Aug 8, 2011 at 19:36,
wrote: Hey,
do you think to create a own parser based on boost.qi is the best solution?
Thanks
Am 08.08.2011 13:15, schrieb Diederick C. Niehorster:
You'll have to read through the source code (which isn't straight forward). There will be a parser somewhere (maybe its easiest to find the right file by putting a breakpoint before a call to program_options and stepping through till you're in the parser. Once there, the change is probably pretty trivial. And if you can do it in a nice configurable way with a user exposed setting, the maintainers might accept a patch. Though I'm worried about how you are going to internally distinguish the + and - options...
Best, Dee
On Mon, Aug 8, 2011 at 19:10,
wrote: Am 08.08.2011 12:52, schrieb Leo Cacciari:
Il 08/08/2011 12:47 PM, boost_mailinglist@gmx.de ha scritto:
Hello,
the app is grown up step by step and a other person has taken the decission to use the "+" as a sign for an argument. (All the letters for the - are used.) My task is more or less to rewrite the old case() parser to a new one, possible based on boost.program_options, to get a clear structure. At the moment I'm not very interesting to change the argument style, because all the example and more has also to be change to the new style.
Well then I believe you're out of luck. AFAIK and as is stated in the library documentation, start character for short options is - or / (the latter to conform to windows usage).
Is there a way to get the library "patched" and replace the / through +? The app will only be used under linux.
Thanks _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (4)
-
boost_mailinglist@gmx.de
-
Diederick C. Niehorster
-
Hazrat Pradipta Ranjali
-
Leo Cacciari