enhancement request; printUsage() function

2006-11-14
2013-05-28
  • Andrew Peter Marlow

    Hello,

    Can printUsage() please be added to CmdLine? I have an application that provides its own -h flag rather than using the one that CmdLine can give you. When -h is given  I wish to print the normal command line usage that CmdLine builds up, plus some supplementary text of my own that is not not fully known until the command line has been parsed.

    Perhaps the function could be added to StdOutput, then failure could call it. Also, CmdLine could then provide printUsage, which it would implement by delegation to the private data member, _output.

    Regards,

    Andrew Marlow

     
    • Mike Smoot

      Mike Smoot - 2006-11-14

      Hi Andrew,

      If I understand what you're getting at, you'd like to override a printUsage() method to generate your own usage message, correct?  If so, then the "TCLAP approved" way of doing this is to implement your own
      version of CmdLineOutput.h, for instance by overriding StdOutput.h.  Once you've done this, set the output using CmdLine::setOutput(yourNewOutput).

      If I misunderstand and you're just looking to call a printUsage() method at a time of your own choosing, then you can do that using cmd.getOutput()->usage(cmd) where cmd is your CmdLine object.

      Let me know if that doesn't work for you.

      thanks,
      Mike

       
    • Andrew Peter Marlow

      cmd.getOutput()->usage(cmd) is *exactly* what I need. Thanks very much!
      BTW, is there any chance that usage could be implemented for CmdLine using the delegation above? It would be slightly more convenient, it's no big deal.

      -apm

       
    • Andrew Peter Marlow

      Any chance of my enhancement request being done please? It seems such a simple thing....

      -Andrew M.

       
      • Daniel Aarno

        Daniel Aarno - 2008-10-26

        I think we have not done this since there exists ways to achieve the same thing, and this would only be one more method to maintain. However, this does not mean it won't happen. Patches are always persuasive, if you want to suggest a patch I'll review it.

         

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks