Menu

SwitchArg with no long name

Help
2013-09-05
2018-01-02
  • Tom Browder

    Tom Browder - 2013-09-05

    Is it possible, without subclassing, to have a short option without a corresponding long option?

     
  • Daniel Aarno

    Daniel Aarno - 2013-09-05

    Short answer: no.

    All the "standard" arg-types take short and long flags. Can you describe a situation when it would be useful not to have a long option?

     
    • Tom Browder

      Tom Browder - 2013-09-06

      Yes: we sometimes would like to see an alias for a short option, e.g., both '-?' and '-h' for '--help'. Along the same lines we would like to be able to define some default options for our users (similar to the existing '--help' and '--version') and also turn off some (like '--version).

      Another nice-to-have would be the ability to add a callback function for an option's value (default or otherwise).

      We have used sub-classing for some output formatting but I had to get into more of TCLAP's guts for some things (like ignoring '--version').

      We (http://brlcad.org) love TCLAP and are trying to get it to fit our needs for a common arg-parsing environment and auto-documentation ability (for over 400 command-line programs). We want to be able to have tight control over the arg-handling interface (developer and user). I will be happy to help in any way I can to get any such features added.

      Best regards,

      -Tom

       

Log in to post a comment.