#3 Divide arguments by groups


I have used TCLAP for a month or so now. I think it would be great if I could divide the arguments into groups, so each group would be shown separately in the --help.

And maybe one could also specify a prefix for a group, so all arguments from it would use the prefix. So if an argument is in a group with prefix "s", has a flag "f" and a name "file", it would match a "-sf" and a "--sfile" in the command line. This would be very helpful if you have way too many arguments, but still want to be able to use the flags instead of the full names.


  • Mike Smoot

    Mike Smoot - 2007-08-31

    Logged In: YES
    Originator: NO

    It should be fairly easy to write your own class that overrides the CmdLineOutput interface that defines the output methods. Since I don't have a good sense of how the groups would be defined, I think I'd prefer to leave this sort of specialization out of the library. However, if you come up with a good implementation, feel free to submit a patch and I'll consider including it.

    As the library is written now it would be very hard to allow grouping with single flag arguments. This is because of how combined flags are handled (i.e. allowing "cmd -abc" in addition to "cmd -a -b -c"). How would -sf be distinguished from -s -f? Again, if you can come up with a solid implementation, I'd be happy to consider including this.

  • Mike Smoot

    Mike Smoot - 2008-05-06
    • status: open --> closed

Log in to post a comment.