Signed-off-by: Jonatan Schlag jonatan.schlag@ipfire.org --- src/bash-completion/network | 92 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 91 insertions(+), 1 deletion(-)
diff --git a/src/bash-completion/network b/src/bash-completion/network index 5fd6191..668c699 100644 --- a/src/bash-completion/network +++ b/src/bash-completion/network @@ -343,7 +343,7 @@ _network_settings() { _network_vpn() { local words=( $@ )
- local commands="ipsec" + local commands="ipsec security-policies" local cmd="$(_network_find_on_cmdline "${commands}")" if [[ -z "${cmd}" ]]; then COMPREPLY=( $(compgen -W "${commands}" -- "${cur}") ) @@ -356,6 +356,9 @@ _network_vpn() { ipsec) _network_vpn_ipsec ${args} ;; + security-policies) + _network_vpn_security_policies ${args} + ;; esac }
@@ -520,6 +523,93 @@ _network_vpn_ipsec_connection_subcommands_security_policy() { fi }
+_network_vpn_security_policies() { + local words=( $@ ) + + local commands="destroy new $(network raw list-vpn-security-policies-all)" + local cmd="$(_network_find_on_cmdline "${commands}")" + if [[ -z "${cmd}" ]]; then + COMPREPLY=( $(compgen -W "${commands}" -- "${cur}") ) + return 0 + fi + + + local args="${words[@]:1}" + case "${cmd}" in + destroy) + : + ;; + new) + : + ;; + *) + if network raw vpn-security-policy-exists ${cmd}; then + _network_vpn_security_policies_subcommands ${cmd} ${args} + fi + ;; + esac +} + +_network_vpn_security_policies_subcommands() { + local policy=${1} + shift + local words=( $@ ) + + local commands="cipher compression group-type integrity key-exchange lifetime pfs show" + local cmd="$(_network_find_on_cmdline "${commands}")" + if [[ -z "${cmd}" ]]; then + COMPREPLY=( $(compgen -W "${commands}" -- "${cur}") ) + return 0 + fi + + + local args="${words[@]:1}" + case "${cmd}" in + cipher) + _network_vpn_security_policies_subcommands_cipher ${policy} ${args} + ;; + compression) + _network_vpn_security_policies_subcommands_compression ${policy} ${args} + ;; + group-type) + _network_vpn_security_policies_subcommands_group_type ${policy} ${args} + ;; + integrity) + _network_vpn_security_policies_subcommands_integrity ${policy} ${args} + ;; + key-exchange) + _network_vpn_security_policies_subcommands_key_exchange ${policy} ${args} + ;; + pfs) + _network_vpn_security_policies_subcommands_pfs ${policy} ${args} + ;; + esac +} + +_network_vpn_security_policies_subcommands_cipher() { + : +} + +_network_vpn_security_policies_subcommands_compression() { + : +} + +_network_vpn_security_policies_subcommands_group_type() { + : +} + +_network_vpn_security_policies_subcommands_integrity() { + : +} + +_network_vpn_security_policies_subcommands_key_exchange() { + : +} + +_network_vpn_security_policies_subcommands_pfs() { + : +} + _network_zone() { local words=( $@ )