mbox

[8/8] autocompletion: use hids instead of ids

Message ID 1500998833-10543-9-git-send-email-jonatan.schlag@ipfire.org
State New
Headers

Message

Jonatan Schlag July 26, 2017, 2:07 a.m. UTC
  Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
---
 src/bash-completion/network | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Michael Tremer July 26, 2017, 8:30 a.m. UTC | #1
On Tue, 2017-07-25 at 18:07 +0200, Jonatan Schlag wrote:
> Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
> ---
>  src/bash-completion/network | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/bash-completion/network b/src/bash-completion/network
> index 820c2d4..529a772 100644
> --- a/src/bash-completion/network
> +++ b/src/bash-completion/network
> @@ -421,7 +421,7 @@ _network_zone_subcommand_config() {
>  
>  	local words=( $@ )
>  
> -	local commands="destroy list new $(network raw list-zone-config-ids
> ${zone})"
> +	local commands="destroy list new $(network raw list-zone-config-hids
> ${zone})"
>  
>  	local cmd="$(_network_find_on_cmdline "${commands}")"
>  	if [[ -z "${cmd}" ]]; then
> @@ -442,7 +442,7 @@ _network_zone_subcommand_config() {
>  		*)
>  			# Check if we get a valid id
>  			# TODO: We should also accept a valid hid
> -			if network raw zone-config-id-is-valid ${zone}
> ${cmd}; then
> +			if network raw zone-config-id-is-valid ${zone} ${cmd}
> || network raw zone-config-hid-is-valid ${zone} ${cmd}; then
>  				_network_zone_subcommand_config_subcommand
> ${zone} ${args}
>  			fi
>  			;;

Again, is it not smarter to assume that a HID has been given instead of an ID?

Saves us a call of the second function...

-Michael