FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

optional, with default value

 
Post new topic   Reply to topic     Forum Index -> Doost
View previous topic :: View next topic  
Author Message
baxissimo



Joined: 23 Oct 2006
Posts: 241
Location: Tokyo, Japan

PostPosted: Wed Oct 10, 2007 1:07 am    Post subject: optional, with default value Reply with quote

I want to have an argument that behaves in three different ways:


  • if user omits the argument it does one thing
  • if user provides a plain --argument it does another thing
  • if user gives a value --argument=32 it does something else still


An example would be a --compression flag. If not specified, you get no compression. With just --compression you get a default compression level. With --compression=7 you get a specific compression level.

Any way to do that with ProgramOptions?
Back to top
View user's profile Send private message
aarti_pl



Joined: 25 Jul 2006
Posts: 28

PostPosted: Fri Oct 12, 2007 2:45 am    Post subject: Reply with quote

The problem with such a feature is that it will currently disallow using options with not-adjacent values.
E.g. you can write option with value:
--compression=6
or
--compression 6

Proper solution would be to add additional style for CommandLineStorage for such type of options, and reimplement parsers to follow choosen style. Styles probably need some more care anyway.

I will put it on my TODO list, as it will take more time to implement.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Doost All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group