nxbdi / unix4j

Automatically exported from code.google.com/p/unix4j
1 stars 0 forks source link

Acronym for options: provide a way to distinguish between the long name and the acronym #9

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
With the new @Acronym annotation, only the long name option exists in the 
option enum for a command. As a consequence, the command's toString() 
representation always prints the long option names.

It would be nice to provide a way to print short option names if they are 
passed to the command through the acronym, e.g. for the "ls" command, if one 
writes

ls(Ls.Options.l.a)

the command to string should be

ls -la

instead of 

ls --longFormat --allFiles

One way to achieve this is by adding a new method  to OptionSet:
boolean useOptionAcronym()

This flag should then be set in the generated OptionSet. There are different 
possibilities to do this
(a) when the first chosen option is an acronym
(b) when the last chosen option is an acronym
(c) when any chosen option is an acronym

Note: it is not very practical to distinguish between acronym and long option 
name on a per-option basis.

Original issue reported on code.google.com by terz...@gmail.com on 15 Jul 2012 at 12:26

GoogleCodeExporter commented 9 years ago

Original comment by terz...@gmail.com on 15 Jul 2012 at 12:35

GoogleCodeExporter commented 9 years ago
Resolved. Option (b) was implemented.

Original comment by terz...@gmail.com on 13 Aug 2012 at 2:33