Fixes: #11374
Signed-off-by: Jonatan Schlag jonatan.schlag@ipfire.org --- src/bash-completion/network | 19 +++++++++++++++++++ src/network | 26 ++++++++++++++++++++++++++ 2 files changed, 45 insertions(+)
diff --git a/src/bash-completion/network b/src/bash-completion/network index 27272e9..ae358bd 100644 --- a/src/bash-completion/network +++ b/src/bash-completion/network @@ -258,6 +258,25 @@ _network_port_subcommand() { _network_route() { local words=( $@ )
+ local commands="static" + local cmd="$(_network_find_on_cmdline "${commands}")" + if [[ -z "${cmd}" ]]; then + COMPREPLY=( $(compgen -W "${commands}" -- "${cur}") ) + return 0 + fi + + case "${cmd}" in + static) + local args="${words[@]}" + _network_route_static ${args} + ;; + esac + +} + +_network_route_static() { + local words=( $@ ) + local commands="add list remove reload" local cmd="$(_network_find_on_cmdline "${commands}")" if [[ -z "${cmd}" ]]; then diff --git a/src/network b/src/network index fbb7e9a..4d5955f 100644 --- a/src/network +++ b/src/network @@ -752,6 +752,32 @@ cli_route() { shift
case "${action}" in + static) + cli_route_static $@ + ;; + *) + error "Unrecognized action: ${action}" + cli_run_help network route + + exit ${EXIT_ERROR} + ;; + esac + + exit ${EXIT_OK} + + +} + +cli_route_static() { + if cli_help_requested $@; then + cli_show_man network-route-static + exit ${EXIT_OK} + fi + + local action=${1} + shift + + case "${action}" in # Add a new route. add) route_add $@