
How can I disable the standard arguments 'help' and 'version'? Cheers

On Sun, 03 Oct 2010 19:18:08 +0200, Ben Franksen
How can I disable the standard arguments 'help' and 'version'?
If you're not fully committed to the cmdargs package, you might try my package 'console-program' instead http://hackage.haskell.org/package/console-program. It does not have built-in "--help" or "--version" functionality. (There is a function 'showUsage' that takes the description of the command/option structure of your program, and prints "--help" style usage information, but you use this at your own discretion.) Regards, Arie

Arie Peterson wrote:
On Sun, 03 Oct 2010 19:18:08 +0200, Ben Franksen
wrote: How can I disable the standard arguments 'help' and 'version'?
If you're not fully committed to the cmdargs package, you might try my package 'console-program' instead http://hackage.haskell.org/package/console-program. It does not have built-in "--help" or "--version" functionality. (There is a function 'showUsage' that takes the description of the command/option structure of your program, and prints "--help" style usage information, but you use this at your own discretion.)
Thanks, looks good. I will certainly try it out. Cheers Ben

Hi Ben,
How can I disable the standard arguments 'help' and 'version'?
In general I suggest you email the author of the cmdargs package directly, as well as cc'ing the mailing list (otherwise the author might miss this message, as I did!) In CmdArgs there is currently no way to suppress either --help or --version, but I am currently reviewing a patch (from you!) and expect that the next version will have both these features. The hard part is making sure the defaults match what people expect and that the options to modify the behaviour are discoverable and natural, but I'm sure I'll find something. Thanks, Neil
If you're not fully committed to the cmdargs package, you might try my package 'console-program' instead http://hackage.haskell.org/package/console-program. It does not have built-in "--help" or "--version" functionality. (There is a function 'showUsage' that takes the description of the command/option structure of your program, and prints "--help" style usage information, but you use this at your own discretion.)
Thanks, looks good. I will certainly try it out.
Cheers Ben
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

On 11/10/10 22:04, Neil Mitchell wrote:
Hi Ben,
How can I disable the standard arguments 'help' and 'version'?
In general I suggest you email the author of the cmdargs package directly, as well as cc'ing the mailing list (otherwise the author might miss this message, as I did!)
In CmdArgs there is currently no way to suppress either --help or --version, but I am currently reviewing a patch (from you!) and expect that the next version will have both these features. The hard part is making sure the defaults match what people expect and that the options to modify the behaviour are discoverable and natural, but I'm sure I'll find something.
This makes me curious. What's the use case where you want to allow the user to pass arguments on the command line, but you don't want that user to be able to use '--help' to find out what arguments may be passed? /M -- Magnus Therning (OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus@therning.org http://therning.org/magnus identi.ca|twitter: magthe

On 12 October 2010 16:32, Magnus Therning
This makes me curious. What's the use case where you want to allow the user to pass arguments on the command line, but you don't want that user to be able to use '--help' to find out what arguments may be passed?
When you don't want to bother defining the help options/descriptions? :p (alternatively, you may wish to provide a more full-featured version like what darcs does by using a pager) -- Ivan Lazar Miljenovic Ivan.Miljenovic@gmail.com IvanMiljenovic.wordpress.com

This makes me curious. What's the use case where you want to allow the user to pass arguments on the command line, but you don't want that user to be able to use '--help' to find out what arguments may be passed?
When you don't want to bother defining the help options/descriptions? :p
(alternatively, you may wish to provide a more full-featured version like what darcs does by using a pager)
You can already do this with CmdArgs. If you use cmdArgsMode/process it returns a structure populated to say what to do next (i.e. display a help message), but you are welcome to do something different, or do what it says in a different way. However, I can see some people might want to remove help entirely, so I'll try and find a balance. Thanks, Neil

Neil Mitchell wrote:
This makes me curious. What's the use case where you want to allow the user to pass arguments on the command line, but you don't want that user to be able to use '--help' to find out what arguments may be passed?
I wanted to create a clone of an existing program that had no help option and instead gave the help output if it saw an invalid option.
When you don't want to bother defining the help options/descriptions? :p
(alternatively, you may wish to provide a more full-featured version like what darcs does by using a pager)
You can already do this with CmdArgs. If you use cmdArgsMode/process it returns a structure populated to say what to do next (i.e. display a help message), but you are welcome to do something different, or do what it says in a different way. However, I can see some people might want to remove help entirely, so I'll try and find a balance.
The point here was not so much removing --help, but rather that I want to have control over the 'standard' options (help,version,verbosity) in the same way as for the rest. My program might not have a version, so why offer --version? Or maybe I want a different name for it because the -V is already used for something else, which I cannot change for backwards compatibility. I might want another name for --help, for instance -h. The standard -? does not work in all shells/configurations and --help might look strange if all other options are of the one-dash-one-character sort. I would also like to configure the help text for the standard options, for instance for i18n or because I like starting with a lower case letter or... Cheers Ben

Ben Franksen schrieb:
Neil Mitchell wrote:
This makes me curious. What's the use case where you want to allow the user to pass arguments on the command line, but you don't want that user to be able to use '--help' to find out what arguments may be passed?
I wanted to create a clone of an existing program that had no help option and instead gave the help output if it saw an invalid option.
I find it very annoying if a program floods my terminal with a help page, when I just misspelled something. A short descriptive message that points to the mistake would be of more help for me.

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 10/13/10 06:07 , Henning Thielemann wrote:
Ben Franksen schrieb:
I wanted to create a clone of an existing program that had no help option and instead gave the help output if it saw an invalid option.
I find it very annoying if a program floods my terminal with a help page, when I just misspelled something. A short descriptive message that points to the mistake would be of more help for me.
He mentioned that he has backward compatibility constraints. In an ideal world.... - -- brandon s. allbery [linux,solaris,freebsd,perl] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.10 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAky1xmUACgkQIn7hlCsL25WWpwCdFM209D0Y0FfhBwgeOnfyuzJa SoYAnAhNuo1uhFE6hNErRG8QdIPmQmB6 =XTVN -----END PGP SIGNATURE-----

Hi, Am Dienstag, den 12.10.2010, 16:42 +1100 schrieb Ivan Lazar Miljenovic:
On 12 October 2010 16:32, Magnus Therning
wrote: This makes me curious. What's the use case where you want to allow the user to pass arguments on the command line, but you don't want that user to be able to use '--help' to find out what arguments may be passed?
When you don't want to bother defining the help options/descriptions? :p
note that people expect "cmd --help" to at least do nothing. So if your program is called "launchMissiles", please make it at least spit out a message like "your evil dictator was too lazy to write a help message" when it is called with --help. (That is if you are sharing your program. Not sure if you should share "launchMissiles" at all.) Greetings, Joachim -- Joachim Breitner e-Mail: mail@joachim-breitner.de Homepage: http://www.joachim-breitner.de ICQ#: 74513189 Jabber-ID: nomeata@joachim-breitner.de

Joachim Breitner wrote:
Am Dienstag, den 12.10.2010, 16:42 +1100 schrieb Ivan Lazar Miljenovic:
On 12 October 2010 16:32, Magnus Therning
wrote: This makes me curious. What's the use case where you want to allow the user to pass arguments on the command line, but you don't want that user to be able to use '--help' to find out what arguments may be passed?
When you don't want to bother defining the help options/descriptions? :p
note that people expect "cmd --help" to at least do nothing. So if your program is called "launchMissiles", please make it at least spit out a message like "your evil dictator was too lazy to write a help message" when it is called with --help.
(That is if you are sharing your program. Not sure if you should share "launchMissiles" at all.)
launchMissiles = putStrLn "Boom! (just kidding :)" BTW another cool feature of an auto-magic option parsing lib is the GNU standard "--" (arguments after this are not to be treated as options). Cheers Ben

The point here was not so much removing --help, but rather that I want to have control over the 'standard' options (help,version,verbosity) in the same way as for the rest. My program might not have a version, so why offer --version? Or maybe I want a different name for it because the -V is already used for something else, which I cannot change for backwards compatibility. I might want another name for --help, for instance -h. The standard -? does not work in all shells/configurations and --help might look strange if all other options are of the one-dash-one-character sort. I would also like to configure the help text for the standard options, for instance for i18n or because I like starting with a lower case letter or...
That i18n is a fantastic argument - and one that really means cmdargs has no choice but to support all the attributes on help/version.
BTW another cool feature of an auto-magic option parsing lib is the GNU standard "--" (arguments after this are not to be treated as options).
cmdargs also supports this by default. Thanks, Neil

That i18n is a fantastic argument - and one that really means cmdargs has no choice but to support all the attributes on help/version.
Is it possible to change the "groupname" for the implicit "help" and "version" options? I have defined some options with groupname "development flags", but I would want to have another groupname for "help" and "version". (Or -- even better -- have them included in the "Common flags" section. I toyed around with something like 'helpArg [groupname "Something"]', but without success. Thanks, Sönke (Using System.Console.CmdArgs.Implicit from cmdargs-0.6.5.)

Hi Sönke,
helpArg [groupname "Something"] should work, but it sounds like it
doesn't. I've raised a bug:
http://code.google.com/p/ndmitchell/issues/detail?id=392
I'll probably have this fixed in about a week.
Thanks, Neil
On Thu, Dec 30, 2010 at 4:05 PM, Sönke Hahn
That i18n is a fantastic argument - and one that really means cmdargs has no choice but to support all the attributes on help/version.
Is it possible to change the "groupname" for the implicit "help" and "version" options? I have defined some options with groupname "development flags", but I would want to have another groupname for "help" and "version". (Or -- even better -- have them included in the "Common flags" section. I toyed around with something like 'helpArg [groupname "Something"]', but without success.
Thanks, Sönke
(Using System.Console.CmdArgs.Implicit from cmdargs-0.6.5.)

Hi Sönke,
I've just released cmdargs-0.6.6 which supports helpArgs [groupname "Something"]
Thanks, Neil
On Thu, Dec 30, 2010 at 5:09 PM, Neil Mitchell
Hi Sönke,
helpArg [groupname "Something"] should work, but it sounds like it doesn't. I've raised a bug: http://code.google.com/p/ndmitchell/issues/detail?id=392
I'll probably have this fixed in about a week.
Thanks, Neil
On Thu, Dec 30, 2010 at 4:05 PM, Sönke Hahn
wrote: That i18n is a fantastic argument - and one that really means cmdargs has no choice but to support all the attributes on help/version.
Is it possible to change the "groupname" for the implicit "help" and "version" options? I have defined some options with groupname "development flags", but I would want to have another groupname for "help" and "version". (Or -- even better -- have them included in the "Common flags" section. I toyed around with something like 'helpArg [groupname "Something"]', but without success.
Thanks, Sönke
(Using System.Console.CmdArgs.Implicit from cmdargs-0.6.5.)
participants (9)
-
Arie Peterson
-
Ben Franksen
-
Brandon S Allbery KF8NH
-
Henning Thielemann
-
Ivan Lazar Miljenovic
-
Joachim Breitner
-
Magnus Therning
-
Neil Mitchell
-
Sönke Hahn