App-Cmd icon indicating copy to clipboard operation
App-Cmd copied to clipboard

Can I use uppercase subcommand names?

Open bokutin opened this issue 7 years ago • 0 comments

Hi.

I wrote a command like the one below. . .

use MyApp::Cmd::Command::IDS;
...
sub command_names { 'IDS' }
...

The lower line seems to force lowercase letters.

diff --git a/lib/App/Cmd.pm b/lib/App/Cmd.pm                                                                                                                 
index 84e5ce1..162ce3e 100644                                                                                                                                
--- a/lib/App/Cmd.pm                                                                                                                                         
+++ b/lib/App/Cmd.pm                                                                                                                                         
@@ -208,7 +208,7 @@ sub _command {                                                                                                                           
                                                                                                                                                             
     next unless $plugin->can("command_names");                                                                                                              
                                                                                                                                                             
-    foreach my $command (map { lc } $plugin->command_names) {                                                                                               
+    foreach my $command ($plugin->command_names) {                                                                                                          
       die "two plugins for command $command: $plugin and $plugin{$command}\n"                                                                               
         if exists $plugin{$command};   

Can not use uppercase subcommands by just overriding command_names? Or is it App::Cmd's design to do as below?

my $app = MyApp::Cmd->new;
$app->{command}{IDS} = delete $app->{command}{ids};
$app->run;

Regards, Tomohiro Hosaka

bokutin avatar Jul 19 '18 06:07 bokutin