fortify: zsh complete show instance list
All checks were successful
Tests / Go tests (push) Successful in 37s
Nix / NixOS tests (push) Successful in 2m59s

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
Ophestra 2024-12-21 21:13:53 +09:00
parent cb98baa19d
commit bf11241649
Signed by: cat
SSH Key Fingerprint: SHA256:gQ67O0enBZ7UdZypgtspB2FDM1g3GVw8nX0XSdcFw8Q

View File

@ -1,7 +1,8 @@
#compdef fortify #compdef fortify
_fortify_app() { _fortify_app() {
_path_files -g "*.(json|ftfy)" __fortify_files
return $?
} }
_fortify_run() { _fortify_run() {
@ -26,6 +27,29 @@ _fortify_ps() {
'--short[Print instance id]' '--short[Print instance id]'
} }
_fortify_show() {
_alternative \
'instances:domains:__fortify_instances' \
'files:files:__fortify_files'
}
__fortify_files() {
_files -g "*.(json|ftfy)"
return $?
}
__fortify_instances() {
local -a out
shift -p
out=( ${(f)"$(_call_program commands fortify ps --short 2>&1)"} )
if (( $#out == 0 )); then
_message "No active instances"
else
_describe "active instances" out
fi
return $?
}
(( $+functions[_fortify_commands] )) || _fortify_commands() (( $+functions[_fortify_commands] )) || _fortify_commands()
{ {
local -a _fortify_cmds local -a _fortify_cmds