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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
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
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
Any chance of my enhancement request being done please? It seems such a simple thing....
-Andrew M.
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.