c-blake / cligen

Nim library to infer/generate command-line-interfaces / option / argument parsing; Docs at
https://c-blake.github.io/cligen/
ISC License
509 stars 24 forks source link

The += operation results in bad value if comma separated #86

Closed genotrance closed 5 years ago

genotrance commented 5 years ago

Consider: symOverride: seq[string] = @[]

If I specify --symOverride=A,B,C,D, I get a correct @["A", "B", "C", "D"].

If I specify --symOverride+=A,B,C,D, with the +, I get a wrong @["A", "AB", "ABC", "ABCD"].

This means I cannot do the following:

--symOverride=A,B,C,D --symOverride+=E,F,G,H which results in @["A", "B", "C", "D", "E", "EF", "EFG", "EFGH"]. After the first =, any += can only add one at a time.

c-blake commented 5 years ago

I think you want to use ,+= not +=. as in (one of my test programs) ./test/AllSeqTypes --s,+=,a,b.

genotrance commented 5 years ago

Users will never know to use that operator! Wish it was documented on cligen to know these nuances.

c-blake commented 5 years ago

It is in --help-syntax, provided to every command generated by cligen. I have a new version of that text in a not quite released version. It might be clearer. It's a very advanced usage mode, though. People may not guess that it even exists. Not sure what to do about that.

c-blake commented 5 years ago

(that text == that --help-syntax help text).

c-blake commented 5 years ago

There is a large discussion thread here about this feature: https://github.com/c-blake/cligen/issues/71 that was about the re-design from CLI-author-driven-delimiter/delimiting convention choice to CLI-user-driven things.