Update vnstat completion

This commit is contained in:
Shohei YOSHIDA 2023-05-21 13:08:24 +09:00
parent 0ebf45ba93
commit 8990e74097
No known key found for this signature in database
GPG Key ID: C9A1BB11BB940CF2
1 changed files with 8 additions and 5 deletions

View File

@ -28,7 +28,7 @@
# Description # Description
# ----------- # -----------
# #
# Completion script for vnstat 2.6 # Completion script for vnstat 2.10
# #
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Authors # Authors
@ -54,6 +54,7 @@ _arguments -C : \
"($period)"{-y,--years}'[show traffic statistics for the last year]' \ "($period)"{-y,--years}'[show traffic statistics for the last year]' \
"($period)"{-5,--fiveminutes}'[show traffic statistic with a 5 minute resolution for the last hours]' \ "($period)"{-5,--fiveminutes}'[show traffic statistic with a 5 minute resolution for the last hours]' \
'--dbdir[specify database directory]:directory:_files -/' \ '--dbdir[specify database directory]:directory:_files -/' \
'--dbiflist[List interfaces currently in the database]::mode:->dbiflist' \
'(-D --debug)'{-D,--debug}'[show additional debug output]' \ '(-D --debug)'{-D,--debug}'[show additional debug output]' \
'(-e --end)'{-e,--end}'[end the list output with a specific date]:date:' \ '(-e --end)'{-e,--end}'[end the list output with a specific date]:date:' \
'--delete[delete database and stop monitoring selected interface]' \ '--delete[delete database and stop monitoring selected interface]' \
@ -89,13 +90,11 @@ _arguments -C : \
&& ret=0 && ret=0
case "$state" in case "$state" in
(live) (live)
_values 'live mode' \ _values 'live mode' \
'0[packets per second]' \ '0[packets per second]' \
'1[traffic counters]' && ret=0 '1[traffic counters]' && ret=0
;; ;;
(style) (style)
_values 'output style' \ _values 'output style' \
'0[narrow output]' \ '0[narrow output]' \
@ -104,13 +103,17 @@ case "$state" in
'3[enable average traffic rate]' \ '3[enable average traffic rate]' \
'4[disable use of terminal control characters]' && ret=0 '4[disable use of terminal control characters]' && ret=0
;; ;;
(interface) (interface)
local interfaces="$(_call_program interfaces 'vnstat --iflist')" local interfaces="$(_call_program interfaces 'vnstat --iflist')"
interfaces="${interfaces#*:}" interfaces="${interfaces#*:}"
_values -s + 'interface' ${(z)interfaces} && ret=0 _values -s + 'interface' ${(z)interfaces} && ret=0
;; ;;
(dbiflist)
_values 'mode' \
'0[one line verbose format]' \
'1[one interface per line]' \
&& ret=0
;;
esac esac
return ret return ret