6 function _ufw_delete_rules {
7 if ufw status &> /dev/null ; then
9 | perl -n -e'/\[ +(\d+)\] +([^ ].+)/ && print "\"$1\[$2\]\" "'
13 function _ufw_app_profiles {
14 grep -rhoP "(?<=\[)[^\]]+" /etc/ufw/applications.d/ \
15 | awk '{ print "\""$0"\""}' \
19 local -a _1st_arguments
21 'allow:add allow rule'
22 'app:Application profile commands'
23 'default:set default policy'
26 'disable:disables the firewall'
27 'enable:enables the firewall'
28 'insert:insert RULE at NUM'
29 'limit:add limit rule'
30 'logging:set logging to LEVEL'
31 'reject:add reject rule'
32 'reload:reloads firewall'
33 'reset:reset firewall'
34 'show:show firewall report'
35 'status:show firewall status'
36 'version:display version information'
39 local context state line curcontext="$curcontext"
42 '(--dry-run)--dry-run[dry run]' \
52 _describe -t commands "ufw commands" _1st_arguments
59 'list[list application profiles]' \
60 'info[show information on PROFILE]' \
61 'update[update PROFILE]' \
62 'default[set default application policy]' \
67 'numbered[show firewall status as numbered list of RULES]' \
68 'verbose[show verbose firewall status]' \
73 'on' 'off' 'low' 'medium' 'high' 'full' \
78 'allow' 'deny' 'reject' \
83 'raw' 'builtins' 'before-rules' 'user-rules' 'after-rules' 'logging-rules' 'listening' 'added' \
87 rules="$(_ufw_delete_rules)"
88 if [[ -n "$rules" ]] ; then
90 ${(Q)${(z)"$(_ufw_delete_rules)"}} \
102 ${(Q)${(z)"$(_ufw_app_profiles)"}} \
108 _values 'default-direction' \
109 'incoming' 'outgoing' \