mainGNU Gengetopt - Support: sr #107798, make comma tokeniser optional on...

 
 

sr #107798: make comma tokeniser optional on options declared multiple

Submitter:  Sebastian Freundt <hroptatyr>
Submitted:  Wed 14 Sep 2011 08:49:32 AM UTC
   
 
Category:  None Priority:  5 - Normal
Severity:  2 - Minor Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open Operating System:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 15 Sep 2011 09:00:34 AM UTC, comment #2: 

maybe not, it was my own working title, maybe tokenise or tokenize?  I think people who use gengetopt are generally used to programming slang and RTFMing before using an option with a vague name. :-)

Sebastian Freundt <hroptatyr>
Thu 15 Sep 2011 08:23:05 AM UTC, comment #1: 

do you think 'condense' is the right term?
just for curiosity, at the moment I can't think of another keyword

Lorenzo Bettini <bettini>
Group administrator
Wed 14 Sep 2011 08:49:32 AM UTC, original submission:  

Marking options as multiple allows one to write

  --foo bar --foo baz

and to access the arguments given to the multi-option foo conveniently through an array.  Very intuitively, by default, you can also write:

  --foo bar,baz

which is great behaviour in 99% of the cases, and which I call condensing here.  However, sometimes it's nice to have `multiple' options but no condensing, and instead let the user tokenise the strings if need be.

For instance multiple printf(-like) specs, which (to correspond closely to intuitive behaviour) should not have escaped commas in them, e.g.

  --format "%d, %d" --format "%u, %u"

I suggest to declare that as follows:

option "format" f "printf-like spec" string optional multiple condense=no

where the keyword `condense' is only meaningful in conjunction with the `multiple' keyword and can take `yes' and `no' as values, where `yes' is the default.
Omitting the `condense' clause results in default behaviour, i.e. condense is implicitly `yes'.

Sebastian Freundt <hroptatyr>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bettini (Posted a comment)
  • -email is unavailable- added by hroptatyr (Submitted the item)
  • -email is unavailable- added by hroptatyr
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-09-14 hroptatyr Carbon-Copy- Added hroptatyr

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code