aboutsummaryrefslogtreecommitdiffhomepage
path: root/comp/_fortify
diff options
context:
space:
mode:
authorOphestra Umiker <cat@ophivana.moe>2024-11-20 01:25:19 +0900
committerOphestra Umiker <cat@ophivana.moe>2024-11-20 01:25:19 +0900
commit30b8bce90aa996a15e2af0528a44bae9dddf97f5 (patch)
treefa018a7a76fc10e94c2c7ba00d92463adae41b13 /comp/_fortify
parentde0d78daaef31fbf9a903b492ba678deb6a23cd9 (diff)
fortify: zsh completion
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
Diffstat (limited to 'comp/_fortify')
-rw-r--r--comp/_fortify51
1 files changed, 51 insertions, 0 deletions
diff --git a/comp/_fortify b/comp/_fortify
new file mode 100644
index 00000000..17442372
--- /dev/null
+++ b/comp/_fortify
@@ -0,0 +1,51 @@
+#compdef fortify
+
+_fortify_app() {
+ _path_files -g "*.(json|ftfy)"
+}
+
+_fortify_run() {
+ _arguments \
+ '-a[Fortify application ID]: :_numbers' \
+ '-g[Groups inherited by the app process]: :_groups' \
+ '-d[Application home directory]: :_files -/' \
+ '-u[Passwd name within sandbox]: :_users' \
+ '--wayland[Share Wayland socket]' \
+ '-X[Share X11 socket and allow connection]' \
+ '--dbus[Proxy D-Bus connection]' \
+ '--pulse[Share PulseAudio socket and cookie]' \
+ '--dbus-config[Path to D-Bus proxy config file]: :_files -g "*.json"' \
+ '--dbus-system[Path to system D-Bus proxy config file]: :_files -g "*.json"' \
+ '--dbus-id[D-Bus ID of application, leave empty to disable own paths]:id' \
+ '--mpris[Allow owning MPRIS D-Bus path]' \
+ '--dbus-log[Force logging in the D-Bus proxy]'
+}
+
+(( $+functions[_fortify_commands] )) || _fortify_commands()
+{
+ local -a _fortify_cmds
+ _fortify_cmds=(
+ "app:Launch app defined by the specified config file"
+ "run:Configure and start a permissive default sandbox"
+ "ps:List active apps and their state"
+ "version:Show fortify version"
+ "license:Show full license text"
+ "template:Produce a config template"
+ "help:Show help message"
+ )
+ if (( CURRENT == 1 )); then
+ _describe -t commands 'fortify command' _fortify_cmds || compadd "$@"
+ else
+ local curcontext="$curcontext"
+ cmd="${${_fortify_cmds[(r)$words[1]:*]%%:*}}"
+ if (( $+functions[_fortify_$cmd] )); then
+ _fortify_$cmd
+ else
+ _message "no more options"
+ fi
+ fi
+}
+
+_arguments -C \
+ '-v[Verbose output]' \
+ '*::fortify command:_fortify_commands' \ No newline at end of file