NAME
Getopt::App::Complete - Add autocompletion to you Getopt::App script
SYNOPSIS
use Getopt::App -complete;
run(
'h # Print help',
'bash-completion-script # Print autocomplete script',
sub {
my ($app, @args) = @_;
return print generate_completion_script() if $app->{'bash-completion-script'};
return print extract_usage() if $app->{h};
},
);
DESCRIPTION
Getopt::App::Complete contains helper functions for adding autocompletion to your Getopt::App powered script.
This module is currently EXPERIMENTAL.
EXPORTED FUNCTIONS
complete_reply
$int = complete_reply($app_class);
This function is automatically called by "run" in Getopt::App when loaded with the -complete flag. Returns 0 if the COMP_POINT environment variable is set and undef if not.
This function will print completion options based on COMP_POINT and COMP_LINE to STDOUT, and is aware of subcommands.
generate_completion_script
$str = generate_completion_script();
This function will detect if the bash or zsh shell is in use and return the appropriate initialization commands.