The options for the different types of connections should be also printed correctly when we use autocompletion
Signed-off-by: Jonatan Schlag jonatan.schlag@ipfire.org --- src/bash-completion/network | 17 ++++++++++++++++- src/network | 3 +++ 2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/src/bash-completion/network b/src/bash-completion/network index 71bf245..25cf6aa 100644 --- a/src/bash-completion/network +++ b/src/bash-completion/network @@ -413,7 +413,7 @@ _network_vpn_ipsec_connection_subcommands() { shift local words=( $@ )
- local commands="authentication color description down inactivity-timeout local mode peer remote security-policy show up" + local commands="$(network raw list-valid-ipsec-options "${connection}" "first")" local cmd="$(_network_find_on_cmdline "${commands}")" if [[ -z "${cmd}" ]]; then COMPREPLY=( $(compgen -W "${commands}" -- "${cur}") ) @@ -432,6 +432,9 @@ _network_vpn_ipsec_connection_subcommands() { description) _network_description ${args} ;; + dpd) + _network_vpn_ipsec_connection_subcommands_dpd "${connection}" ${args} + ;; local) _network_vpn_ipsec_connection_subcommands_local_remote ${connection} "local" ${args} ;; @@ -529,6 +532,18 @@ _network_vpn_ipsec_connection_subcommands_security_policy() { fi }
+_network_vpn_ipsec_connection_subcommands_dpd() { + local connection=${1} + shift + local words=( $@ ) + + local commands="$(network raw list-valid-ipsec-options "${connection}" "dpd")" + local cmd="$(_network_find_on_cmdline "${commands}")" + if [[ -z "${cmd}" ]]; then + COMPREPLY=( $(compgen -W "${commands}" -- "${cur}") ) + return 0 + fi +} _network_vpn_security_policies() { local words=( $@ )
diff --git a/src/network b/src/network index 9a2d480..379a71d 100644 --- a/src/network +++ b/src/network @@ -1334,6 +1334,9 @@ cli_raw() { list-next-free-zones) zones_get_next_free ;; + list-valid-ipsec-options) + ipsec_get_valid_options "$@" + ;; list-zone-config-ids) zone_config_list_ids "$@" ;;