Skip to content

Commit

Permalink
chore: add zsh completion
Browse files Browse the repository at this point in the history
install:

```sh
install -m644 ./install/shell-completion/dae.zsh /usr/share/zsh/site-functions/_dae
```

Signed-off-by: ston <ston.jia@qq.com>
  • Loading branch information
st0nie committed Nov 9, 2023
1 parent 7e57531 commit fd10006
Showing 1 changed file with 84 additions and 0 deletions.
84 changes: 84 additions & 0 deletions install/shell-completion/dae.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#compdef _dae dae

_dae() {
local line

_arguments -C \
"-h[help for dae]" \
"--help[help for dae]" \
"-v[version for dae]" \
"--version[version for dae]" \
"1: :(export help honk reload run suspend validate)" \
"*::arg:->args"

case $line[1] in
export)
_dae_export
;;
help)
_dae_help
;;
reload)
_dae_reload
;;
run)
_dae_run
;;
suspend)
_dae_suspend
;;
validate)
_dae_validate
;;
esac

}

_dae_export() {
_arguments -C \
"-h[help for export]" \
"--help[help for export]" \
"1: :(outline)"
}

_dae_help() {
_arguments -C \
"-h[help for help]" \
"--help[help for help]" \
"1: :(export help honk reload run suspend validate)"
}

_dae_reload() {
_arguments -C \
"-h[help for reload]" \
"--help[help for reload]" \
"::pid:($(ps -A | awk '{print $1}'))"
}

_dae_suspend() {
_arguments -C \
"-h[help for suspend]" \
"--help[help for suspend]" \
"::pid:($(ps -A | awk '{print $1}'))"
}

_dae_run() {
_arguments -C \
"-c[Config file of dae]:filename:_files" \
"--config[Config file of dae]:filename:_files" \
"--disable-pidfile[Not generate /var/run/dae.pid]" \
"--disable-timestamp[Disable timestamp]" \
"--logfile[Log file to write]:filename:_files" \
"--logfile-maxbackups[The maximum number of old log files to retain]" \
"--logfile-maxsize[The maximum size in megabytes of the log file before it gets rotated]" \
"-h[help for run]" \
"--help[help for run]"
}

_dae_validate() {
_arguments -C \
"-c[Config file of dae]:filename:_files" \
"--config[Config file of dae]:filename:_files" \
"-h[help for validate]" \
"--help[help for validate]"
}

0 comments on commit fd10006

Please sign in to comment.