diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 01:03:19 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 01:03:19 +0000 |
commit | 6c09f2a45c5541e9c207d14fc7aa21a4a0066bde (patch) | |
tree | 0221189d367bf661f6f9493c4f17a03f0dd4b7d2 /completions/vpnc | |
parent | Releasing progress-linux version 1:2.11-8~progress7.99u1. (diff) | |
download | bash-completion-6c09f2a45c5541e9c207d14fc7aa21a4a0066bde.tar.xz bash-completion-6c09f2a45c5541e9c207d14fc7aa21a4a0066bde.zip |
Merging upstream version 1:2.12.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'completions/vpnc')
-rw-r--r-- | completions/vpnc | 60 |
1 files changed, 28 insertions, 32 deletions
diff --git a/completions/vpnc b/completions/vpnc index bbdb8ee..79ffff3 100644 --- a/completions/vpnc +++ b/completions/vpnc @@ -1,82 +1,78 @@ # bash completion for vpnc -*- shell-script -*- -_vpnc() +_comp_cmd_vpnc() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return case $prev in - --help | --long-help | --version | --id | --username | --domain | --ifname | \ - --application-version | --local-addr | --local-port | --udp-port | --dpd-idle | \ - --target-network | --ifmtu) + --help | --long-help | --version | --id | --username | --domain | \ + --ifname | --application-version | --local-addr | --local-port | \ + --udp-port | --dpd-idle | --target-network | --ifmtu) return ;; --gateway) - _known_hosts_real -- "$cur" + _comp_compgen_known_hosts -- "$cur" return ;; --vendor) - COMPREPLY=($(compgen -W 'cisco netscreen' -- "$cur")) + _comp_compgen -- -W 'cisco netscreen' return ;; --natt-mode) - COMPREPLY=($(compgen -W 'natt none force-natt cisco-udp' \ - -- "$cur")) + _comp_compgen -- -W 'natt none force-natt cisco-udp' return ;; --script | --pid-file | --ca-file) - _filedir + _comp_compgen_filedir return ;; --dh) - COMPREPLY=($(compgen -W 'dh1 dh2 dh5' -- "$cur")) + _comp_compgen -- -W 'dh1 dh2 dh5' return ;; --pfs) - COMPREPLY=($(compgen -W 'nopfs dh1 dh2 dh5 server' -- "$cur")) + _comp_compgen -- -W 'nopfs dh1 dh2 dh5 server' return ;; --ifmode) - COMPREPLY=($(compgen -W 'tun tap' -- "$cur")) + _comp_compgen -- -W 'tun tap' return ;; --debug) - COMPREPLY=($(compgen -W '0 1 2 3 99' -- "$cur")) + _comp_compgen -- -W '0 1 2 3 99' return ;; --auth-mode) - COMPREPLY=($(compgen -W 'psk cert hybrid' -- "$cur")) + _comp_compgen -- -W 'psk cert hybrid' return ;; --ca-dir) - _filedir -d + _comp_compgen_filedir -d return ;; --password-helper) - compopt -o filenames - COMPREPLY=($(compgen -c -- "$cur")) + _comp_compgen_commands return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_help "$1" --long-help)' -- "$cur")) - elif [[ $cur == */* ]]; then + _comp_compgen_help -- --long-help + elif _comp_looks_like_path "$cur"; then # explicit filename - _filedir conf + _comp_compgen_filedir conf else # config name, /etc/vpnc/<name>.conf - local IFS=$' \t\n' reset=$(shopt -p nullglob) - shopt -s nullglob - local -a configs=(/etc/vpnc/*.conf) - configs=("${configs[@]##*/}") - configs=("${configs[@]%.conf}") - $reset - IFS=$'\n' - compopt -o filenames - COMPREPLY=($(compgen -W '${configs[@]}' -- "$cur")) + local -a configs + if _comp_expand_glob configs '/etc/vpnc/*.conf'; then + configs=("${configs[@]##*/}") + configs=("${configs[@]%.conf}") + compopt -o filenames + _comp_compgen -- -W '"${configs[@]}"' + fi fi } && - complete -F _vpnc vpnc + complete -F _comp_cmd_vpnc vpnc # ex: filetype=sh |