Update ufw completion

This commit is contained in:
Shohei YOSHIDA 2025-05-16 17:44:28 +09:00
parent 77cad16cc7
commit d1469c6e4f
No known key found for this signature in database
GPG Key ID: C9A1BB11BB940CF2
1 changed files with 105 additions and 81 deletions

View File

@ -28,7 +28,7 @@
# Description
# -----------
#
# Completion script for The Uncomplicated Firewall (ufw). (https://launchpad.net/ufw).
# Completion script for The Uncomplicated Firewall (ufw) v0.36.2. (https://launchpad.net/ufw).
#
# ------------------------------------------------------------------------------
# Authors
@ -38,9 +38,7 @@
#
# ------------------------------------------------------------------------------
_ufw_logging() {
local params additional second
second=$words[2]
@ -48,23 +46,13 @@ _ufw_logging() {
return
fi
params=(
"on"
"off"
)
additional=(
"low"
"medium"
"high"
"full"
)
params=("on" "off")
additional=("low" "medium" "high" "full")
_describe -t params 'on/off' params
_describe -t additional 'level' additional
}
_ufw_delete() {
local rules complrules second
@ -84,6 +72,31 @@ _ufw_delete() {
_describe -t complrules 'Rules' complrules
}
_ufw_app() {
local ret=1
local -a subcmds=(
"list:list application profiles"
"info:show information on profile"
"update:update profile"
"default:set default application profile"
)
_arguments \
"1: :{_describe 'command' subcmds}" \
&& ret=0
return ret
}
(( $+functions[_flutter_pub_token_subcommand] )) ||
_flutter_pub_token_subcommand() {
local -a subcommands=(
)
_describe -t subcommands 'subcommand' subcommands "$@"
}
_ufw() {
local curcontext="$curcontext" ret=1
local -a state line commands
@ -106,6 +119,7 @@ _ufw() {
"show:show firewall report"
"version:display version information"
"prepend:add rule before all of the same type"
"app:application profile command"
)
_arguments -C -s -S -n \
@ -129,6 +143,9 @@ _ufw() {
(delete)
_ufw_delete && ret=0
;;
(app)
_ufw_app && ret=0
;;
(*)
_default && ret=0
;;
@ -141,5 +158,12 @@ _ufw() {
return ret
}
_ufw
_ufw "$@"
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et