App::shcompgen - Generate shell completion scripts
This document describes version 0.320 of App::shcompgen (from Perl distribution App-shcompgen), released on 2017-08-10.
Usage:
detect_prog(%args) -> [status, msg, result, meta]
Detect a program.
This function is not exported.
Arguments ('*' denotes required arguments):
prog* => str
shell => str
Override guessing and select shell manually.
Returns an enveloped result (an array).
First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.
Return value: (any)
generate(%args) -> [status, msg, result, meta]
Generate shell completion scripts for detectable programs.
bash_global_dir => array[str] (default: ["/etc/bash/completions"])
Directory to put completions scripts.
bash_per_user_dir => array[str]
fish_global_dir => array[str] (default: ["/etc/fish/completions"])
fish_per_user_dir => array[str]
global => bool
Use global completions directory.
Shell has global (system-wide) completions directory as well as per-user. For example, in fish the global directory is by default /etc/fish/completions and the per-user directory is ~/.config/fish/completions.
/etc/fish/completions
~/.config/fish/completions
By default, if running as root, the global is chosen. And if running as normal user, per-user directory is chosen. Using --global or --per-user overrides that and manually select which.
--global
--per-user
helper_global_dir => str (default: "/etc/shcompgen/helpers")
Directory to put helper scripts.
helper_per_user_dir => str
per_option => bool
Create per-option completion script if possible.
If set to true, then attempt to create completion script that register each option. This creates nicer completion in some shells, e.g. fish and zsh. For example, option description can be shown.
This is possible for only some types of scripts, e.g. Perinci::CmdLine- (that does not have subcommands) or Getopt::Long::Descriptive-based ones.
prog => array[str]
Program(s) to generate completion for.
Can contain path (e.g. ../foo) or a plain word (foo) in which case will be searched from PATH.
../foo
foo
remove => bool
Remove completion for script that (now) is not detected to have completion.
The default behavior is to simply ignore existing completion script if the program is not detected to have completion. When the remove setting is enabled, however, such existing completion script will be removed.
remove
replace => bool
Replace existing script.
The default behavior is to skip if an existing completion script exists.
stdout => bool
Output completion script to STDOUT.
tcsh_global_dir => array[str] (default: ["/etc/tcsh/completions"])
tcsh_per_user_dir => array[str]
zsh_global_dir => array[str] (default: ["/usr/local/share/zsh/site-functions"])
zsh_per_user_dir => array[str]
guess_shell() -> [status, msg, result, meta]
Guess running shell.
No arguments.
init(%args) -> [status, msg, result, meta]
Initialize shcompgen.
This subcommand creates the completion directories and initialization shell script, as well as run generate.
generate
list(%args) -> [status, msg, result, meta]
List all shell completion scripts generated by this script.
detail => bool
remove(%args) -> [status, msg, result, meta]
Remove shell completion scripts generated by this script.
Program(s) to remove completion script of.
Please visit the project's homepage at https://metacpan.org/release/App-shcompgen.
Source repository is at https://github.com/perlancar/perl-App-shcompgen.
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=App-shcompgen
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
perlancar <perlancar@cpan.org>
This software is copyright (c) 2017, 2016, 2015, 2014 by perlancar@cpan.org.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install App::shcompgen, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::shcompgen
CPAN shell
perl -MCPAN -e shell install App::shcompgen
For more information on module installation, please visit the detailed CPAN module installation guide.