mirror of
git://git.proxmox.com/git/pve-common.git
synced 2025-02-04 01:46:59 +03:00
CLIHandler: add helper to generate bash completion config
This commit is contained in:
parent
93ddd7bc6e
commit
c45707a0c9
@ -269,6 +269,26 @@ sub verify_api {
|
||||
PVE::RESTHandler::validate_method_schemas();
|
||||
}
|
||||
|
||||
sub generate_bash_completions {
|
||||
my ($class) = @_;
|
||||
|
||||
# generate bash completion config
|
||||
|
||||
$exename = $class;
|
||||
$exename =~ s/^.*:://;
|
||||
|
||||
print <<__EOD__;
|
||||
# $exename bash completion
|
||||
|
||||
# see http://tiswww.case.edu/php/chet/bash/FAQ
|
||||
# and __ltrim_colon_completions() in /usr/share/bash-completion/bash_completion
|
||||
# this modifies global var, but I found no better way
|
||||
COMP_WORDBREAKS=\${COMP_WORDBREAKS//:}
|
||||
|
||||
complete -C '$exename bashcomplete' $exename
|
||||
__EOD__
|
||||
}
|
||||
|
||||
sub generate_pod_manpage {
|
||||
my ($class, $podfn) = @_;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user