diff options
| author | Ophestra <cat@gensokyo.uk> | 2024-12-21 21:13:53 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2024-12-21 21:13:53 +0900 |
| commit | bf11241649cc0ef7bea4188d9baf880b0ea95276 (patch) | |
| tree | 8804f26f1a3de1b2bf1d8132abaf770bc2fa5107 /comp/_fortify | |
| parent | cb98baa19d2f9417068ddac58aa0dffad7e48c31 (diff) | |
fortify: zsh complete show instance list
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'comp/_fortify')
| -rw-r--r-- | comp/_fortify | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/comp/_fortify b/comp/_fortify index b7e97c28..d45f9da6 100644 --- a/comp/_fortify +++ b/comp/_fortify @@ -1,7 +1,8 @@ #compdef fortify _fortify_app() { - _path_files -g "*.(json|ftfy)" + __fortify_files + return $? } _fortify_run() { @@ -26,6 +27,29 @@ _fortify_ps() { '--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() { local -a _fortify_cmds |
