App-Spec-p5 icon indicating copy to clipboard operation
App-Spec-p5 copied to clipboard

Rename App::Spec::Completion::Bash to ...::bash

Open dolmen opened this issue 9 years ago • 4 comments

Rename App::Spec::Completion::Bash to App::Spec::Completion::bash and App::Spec::Completion::Zsh to App::Spec::Completion::zsh. That will allow extension and simplify App::Spec::generate_completion:

sub generate_completion {
    my ($self, %args) = @_;
    my $shell = delete $args{shell};

    require "App/Spec/Completion/$shell.pm";
    "App::Spec::Completion::$shell"->new({ spec => $self })->generate_completion(%args)
}

dolmen avatar Dec 11 '15 13:12 dolmen

As a side note, this is the approach I'm using in my Angel's Prompt project that has shell-specific features.

dolmen avatar Dec 11 '15 13:12 dolmen

This approach also allows the startup of the program to be faster as the shell plugin will only be loaded when used (the use App::Spec::Completion::* at the beginning of App::Spec must be removed as they are replaced by the require).

dolmen avatar Dec 11 '15 13:12 dolmen

Thanks, I'm planning some renaming (and lazy loading) anyway, so that it easier to have plugins. I thought about App::Spec::Generator::Completion::*

angel-PS1 looks interesting =)

perlpunk avatar Dec 11 '15 15:12 perlpunk

I would actually like to move the completion and pod generator to App::AppSpec, so that App::Spec(::Run) is the only thing you need to install for running the app.

perlpunk avatar Dec 11 '15 20:12 perlpunk