polettix / App-Easer

Simplify writing (hierarchical) CLI applications in Perl
https://github.polettix.it/App-Easer
Other
9 stars 0 forks source link

Calling help on a builtin command dies verbosely. #7

Closed djerius closed 6 days ago

djerius commented 1 year ago

Given ./foo:

#! /usr/bin/env perl

use App::Easer V2 => 'run';

exit run( {
        help => "Merge, evaluate, and other stuff",
        execute => sub  { return $_[0]->run_help },
        options => [ {
                getopt  => "verbose|v",
                help    => 'be talkative',
            },
            { getopt => 'help|h' },
        ],
        default_child => '-self',
        children => [ {
                aliases => [ 'merge' ],
                help    => 'merge rolled & derolled evt1 files',
                execute => sub {},
            } ]
    },
    $0, @ARGV
);

Running ./foo help help results in

 at[...]/App/Easer/V2.pm line 92.
        App::Easer::V2::Command::_rwa(App::Easer::V2::Command::Help=HASH(0x5569e4363010)) called at[...]/App/Easer/V2.pm line 128                            
        App::Easer::V2::Command::residual_args(App::Easer::V2::Command::Help=HASH(0x5569e4363010)) called at[...]/App/Easer/V2.pm line 633                   
        App::Easer::V2::Command::Commands::target(App::Easer::V2::Command::Help=HASH(0x5569e4363010)) called at[...]/App/Easer/V2.pm line 656                
        App::Easer::V2::Command::Commands::help_channel(App::Easer::V2::Command::Help=HASH(0x5569e4363010)) called at[...]/App/Easer/V2.pm line 656          
        App::Easer::V2::Command::Commands::help_channel(App::Easer::V2::Command::Help=HASH(0x5569e4344720)) called at[...]/App/Easer/V2.pm line 659          
        App::Easer::V2::Command::Commands::_build_printout_facility(App::Easer::V2::Command::Help=HASH(0x5569e4344720)) called at[...]/App/Easer/V2.pm line 696
        App::Easer::V2::Command::Commands::printout(App::Easer::V2::Command::Help=HASH(0x5569e4344720), "print a help command\x{a}\x{a}Description:\x{a}    Print help for (sub)co"...) called at[...]/App/Easer/V2.pm line 822
        App::Easer::V2::Command::Help::execute(App::Easer::V2::Command::Help=HASH(0x5569e4344720)) called at[...]/App/Easer/V2.pm line 621                   
        App::Easer::V2::Command::run(App::Easer::V2::Command::Help=HASH(0x5569e4344720), "help", "help") called at[...]/App/Easer/V2.pm line 619             
        App::Easer::V2::Command::run(App::Easer::V2::Command=HASH(0x5569e4333d90), "util/bug", "help", "help") called at[...]/App/Easer/V2.pm line 33        
        App::Easer::V2::run(HASH(0x5569e4313ae8), "util/bug", "help", "help") called at ./foo line 19

Similar results obtain for help commands, help tree, but help merge is fine.

polettix commented 1 year ago

Thanks for reporting this as everything else. It will take some time and some refactoring, I guess.

polettix commented 1 year ago

Should be solved by 4fb97e5.

I felt like Andrew Harlan for a little time.

djerius commented 1 year ago

I'm not familiar with Andrew Harlan, but a web search indicates there's a whole range of them to choose from. In particular, which one were you feeling like?

polettix commented 1 year ago

This one 😅

polettix commented 6 days ago

Release v2.008 is out