mbox

[3/8] zone: config list print also hids

Message ID 1500998833-10543-4-git-send-email-jonatan.schlag@ipfire.org
State Accepted
Commit fc36aaf45ddb7b8f1dcdcbcd65b02e8db434f97a
Headers

Message

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

Comments

Michael Tremer July 26, 2017, 8:28 a.m. UTC | #1
This looks good.

It might be better to print just "-" if there is no HID, but that only makes
parsing this output easier which nobody should be doing any ways...

-Michael

On Tue, 2017-07-25 at 18:07 +0200, Jonatan Schlag wrote:
> Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
> ---
>  src/functions/functions.zone | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/src/functions/functions.zone b/src/functions/functions.zone
> index 091bcd6..17d0858 100644
> --- a/src/functions/functions.zone
> +++ b/src/functions/functions.zone
> @@ -634,21 +634,22 @@ zone_config_list() {
>  	assert isset zone
>  
>  	# Print a nice header
> -	local format="%-3s %-20s"
> -	print "${format}" "ID" "HOOK"
> +	local format="%-3s %-20s %-20s"
> +	print "${format}" "ID" "HOOK" "HID"
>  
>  	local config
>  	local hook
>  	local id
> +	local hid
>  
>  	# Print for all config:
>  	# id and hook
> -	# TODO: Add hids here
>  	for config in $(zone_configs_list "${zone}"); do
>  		id=${config##*.}
>  		hook=$(zone_config_get_hook "${zone}" "${config}")
> +		hid=$(zone_config_get_hid "${zone}" "${config}")
>  		assert isset hook
> -		print "${format}" "${id}" "${hook}"
> +		print "${format}" "${id}" "${hook}" "${hid}"
>  	done
>  }
>