diff options
Diffstat (limited to 'roles/ws/minet/files/_minet')
-rw-r--r-- | roles/ws/minet/files/_minet | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/roles/ws/minet/files/_minet b/roles/ws/minet/files/_minet new file mode 100644 index 00000000..8f3e02ca --- /dev/null +++ b/roles/ws/minet/files/_minet @@ -0,0 +1,40 @@ +#compdef _minet minet +#autoload + + +_minet () { + local cmd + if (( CURRENT > 2)); then + cmd=${words[2]} + # Set the context for the subcommand. + curcontext="${curcontext%:*:*}:pass-$cmd" + # Narrow the range of words we are looking at to exclude `pass' + (( CURRENT-- )) + shift words + # Run the completion for the subcommand + case "${cmd}" in + start) + if (( CURRENT == 2 )); then + _minet_complete_entries + fi + ;; + esac + else + local -a subcommands + subcommands=( + "start:Connect to network" + "stop:Disconnect from network" + "restart:Reconnect to network" + "suspend:Suspend current connection" + "resume:Resume suspended connection" + "status:Print connection status" + ) + _describe -t commands 'minet' subcommands + fi +} + +_minet_complete_entries () { + local IFS=$'\n' + local prefix="/usr/local/lib/minet" + _values -C 'connections' ${$(find -L "$prefix" \( -name minet_helpers.sh -o -name template \) -prune -o -type f -executable -print 2>/dev/null | sed -e "s#${prefix}/\{0,1\}##" | sort):-""} +} |