App-ShellCompleter-cpanm
view release on metacpan or search on metacpan
lib/App/ShellCompleter/cpanm.pm view on Meta::CPAN
}
sub run_completer {
my %cargs = @_;
die "This script is for shell completion only\n"
unless $ENV{GETOPT_LONG_DUMP} || $ENV{COMP_LINE} || $ENV{COMMAND_LINE};
# the list of options is taken from Menlo::CLI:Compat. should be updated
# from time to time.
GetOptionsWithCompletion(
sub {
my %args = @_;
my $type = $args{type};
my $word = $args{word};
if ($type eq 'arg') {
log_trace("[_cpanm] Completing arg");
my $seen_opts = $args{seen_opts};
if ($seen_opts->{'--uninstall'} || $seen_opts->{'--reinstall'}) {
return $comp_installed_mods->(word=>$word);
} else {
return $comp_installable->(
mod_prefix => $cargs{mod_prefix},
word=>$word, mirror=>$seen_opts->{'--mirror'});
}
} elsif ($type eq 'optval') {
my $ospec = $args{ospec};
my $opt = $args{opt};
log_trace("[_cpanm] Completing optval (opt=$opt)");
if ($ospec eq 'l|local-lib=s' ||
$ospec eq 'L|local-lib-contained=s') {
return complete_file(filter=>'d', word=>$word);
} elsif ($ospec eq 'format=s') {
return complete_array_elem(
array=>[qw/tree json yaml dists/], word=>$word);
} elsif ($ospec eq 'cpanfile=s') {
return complete_file(word=>$word);
}
}
return [];
},
'f|force' => $noop,
'n|notest!' => $noop,
'test-only' => $noop,
'S|sudo!' => $noop,
'v|verbose' => $noop,
'verify!' => $noop,
'q|quiet!' => $noop,
'h|help' => $noop,
'V|version' => $noop,
'perl=s' => $noop,
'l|local-lib=s' => $noop,
'L|local-lib-contained=s' => $noop,
'self-contained!' => $noop,
'exclude-vendor!' => $noop,
'mirror=s@' => $noop,
'mirror-only!' => $noop,
'mirror-index=s' => $noop,
'M|from=s' => $noop, # url (this is --mirror and --mirror-only combined)
'cpanmetadb=s' => $noop,
'cascade-search!' => $noop,
'prompt!' => $noop,
'installdeps' => $noop,
'skip-installed!' => $noop,
'skip-satisfied!' => $noop,
'reinstall' => $noop,
'interactive!' => $noop,
'i|install' => $noop,
'info' => $noop,
'look' => $noop,
'U|uninstall' => $noop,
'self-upgrade' => $noop,
'uninst-shadows!' => $noop,
'lwp!' => $noop,
'wget!' => $noop,
'curl!' => $noop,
'auto-cleanup=s' => $noop,
'man-pages!' => $noop,
'scandeps' => $noop,
'showdeps' => $noop,
'format=s' => $noop,
'save-dists=s' => $noop,
'skip-configure!' => $noop,
'static-install!' => $noop,
'dev!' => $noop,
'metacpan!' => $noop,
'report-perl-version!' => $noop,
'configure-timeout=i' => $noop,
'build-timeout=i' => $noop,
'test-timeout=i' => $noop,
'with-develop' => $noop,
'without-develop' => $noop,
'with-configure' => $noop,
'without-configure' => $noop,
'with-feature=s' => $noop,
'without-feature=s' => $noop,
'with-all-features' => $noop,
'pp|pureperl!' => $noop,
"cpanfile=s" => $noop,
#$self->install_type_handlers,
#$self->build_args_handlers,
);
}
1;
# ABSTRACT: Shell completion for cpanm
__END__
=pod
=encoding UTF-8
=head1 NAME
App::ShellCompleter::cpanm - Shell completion for cpanm
=head1 VERSION
This document describes version 0.212 of App::ShellCompleter::cpanm (from Perl distribution App-ShellCompleter-cpanm), released on 2023-07-08.
( run in 0.597 second using v1.01-cache-2.11-cpan-e93a5daba3e )