rjbs / App-Cmd

perl framework for testable, extensible command line apps

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Default "--version" option behavior not mentioned

preaction opened this issue · comments

The behavior of the "--version" option does not appear to be mentioned anywhere in the documentation.

Getopt::Long has a default behavior for the --version option that seems useful, but I inadvertently created a "version" option myself and was confused when it got used in my tests (the behavior of the --version option does not work very well under App::Cmd::Tester).

Would it also be a good idea to add a "no_auto_version" option to go with the "no_auto_help" option?

I don't see any default behavior for --version so I'm not sure what you're seeing. Can you provide a program that shows off something?

~$ dzil --version
Unrecognized command: --version

~$ dzil help --version
Unrecognized command: --version

https://github.com/ChicagoPM/Command-Line-Apps In this repository, the "say.pl" is an App::Cmd application. If I do perl say.pl --version, I get:

say.pl
(Getopt::Long::GetOptions version 2.38; Perl version 5.12.4)

The Getopt::Long docs say this about it: auto_version will be enabled if the calling program explicitly specified a version number higher than 2.32 in the use or require statement., which Getopt::Long::Descriptive does.

Also, for some reason, when I do dzil --version, I get:

/Users/doug/perl5/bin/dzil version 4.300028
(Getopt::Long::GetOptions version 2.38; Perl version 5.12.4)

... And now that I've updated Getopt::Long to 2.40 from CPAN, I get what you get, which just leaves me confused... But that solves this issue, I guess!