perlpunk / App-Spec-p5

Writing command line apps made easy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

dolmen opened this issue · 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)
}

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

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).

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 =)

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.