diff --git a/comp/_fortify b/comp/_fortify index b7e97c2..d45f9da 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