-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented completion for zerogwctl
- Loading branch information
Showing
3 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
_zerogwctl() | ||
{ | ||
local cur prev commands | ||
cur="${COMP_WORDS[COMP_CWORD]}" | ||
prev="${COMP_WORDS[COMP_CWORD-1]}" | ||
commands=( | ||
list_commands | ||
get_statistics | ||
pause_websockets | ||
resume_websockets | ||
reopen_logs | ||
--help | ||
-c --config | ||
-s --socket | ||
) | ||
case "${prev}" in | ||
-c|--config|-s|--socket) | ||
COMPREPLY=( $(compgen -A file ${cur}) ) | ||
;; | ||
*) | ||
COMPREPLY=( $(compgen -W "${commands[*]}" -- ${cur}) ) | ||
;; | ||
esac | ||
} | ||
complete -F _zerogwctl zerogwctl | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#compdef zerogwctl | ||
|
||
_zerogwctl() { | ||
local commands | ||
commands=( | ||
list_commands | ||
get_statistics | ||
pause_websockets | ||
resume_websockets | ||
reopen_logs | ||
) | ||
_arguments -s \ | ||
'1:command:('"${commands[*]}"')' \ | ||
'--help[show help]' \ | ||
'(-s --socket -c --config)'{-c+,--config+}'[configuration file]:configuration file:_files -g "*.yaml"' \ | ||
'(-c -s --socket --config)'{-s+,--socket+}'[socket file]:socket file:_files' | ||
} | ||
|
||
_zerogwctl "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters