Commits

Hideo Hattori  committed 3ef439d

initial

  • Participants

Comments (0)

Files changed (2)

File _supervisorctl

+#compdef supervisorctl
+
+typeset -A opt_args
+local context state line
+
+_supervisorctl() {
+    _arguments -s -S \
+        "-c[configuration file path (default /etc/supervisor.conf)]" \
+        "--configuration[configuration file path (default /etc/supervisor.conf)]" \
+        "-h[print usage message and exit]" \
+        "--help[print usage message and exit]" \
+        "-i[start an interactive shell after executing commands]" \
+        "--interactive[start an interactive shell after executing commands]" \
+        "--serverurl[URL on which supervisord server is listening (default "http://localhost:9001").]" \
+        "-s[URL on which supervisord server is listening (default "http://localhost:9001").]" \
+        "-u[username to use for authentication with server]" \
+        "--username[username to use for authentication with server]" \
+        "-p[password to use for authentication with server]" \
+        "--password[password to use for authentication with server]" \
+        "-r[keep a readline history (if readline is available)]" \
+        "--history-file[keep a readline history (if readline is available)]" \
+        "*::supervisorctl commands:_supervisorctl_command"
+}
+
+(( $+functions[_supervisorctl_command] )) ||
+_supervisorctl_command() {
+    local cmd ret=1
+
+    (( $+supervisorctl_cmds )) || _supervisorctl_cmds=(
+        "add:Activates any updates in config for process/group" \
+        "avail:Display all configured processes" \
+        "clear:Clear process/multiple-process/all-process log files" \
+        "exit:Exit the supervisor shell." \
+        "fg:Connect to a process in foreground mode" \
+        "maintail:tail of supervisor main log file" \
+        "open:Connect to a remote supervisord process. (for UNIX domain socket, use unix:///socket/path)" \
+        "pid:Get the PID of supervisord." \
+        "quit:Exit the supervisor shell." \
+        "reload:Restart the remote supervisord." \
+        "remove:Removes process/group from active config" \
+        "reread:Reload the daemon's configuration files" \
+        "restart:Restart process or group." \
+        "shutdown:Shut the remote supervisord down." \
+        "start:Start process or groups." \
+        "status:Get process status info." \
+        "stop:Stop process or group." \
+        "tail:tail of process stdout" \
+        "update:Reload config and add/remove as necessary" \
+        "version:Show the version of the remote supervisord process" \
+        "help:Show help" \
+        )
+
+    if (( CURRENT == 1 )); then
+        _describe -t commands 'supervisorctl subcommand' _supervisorctl_cmds || compadd "$@" - ${(s.:.)${(j.:.)_supervisorctl_syns}}
+    else
+        local curcontext="$curcontext"
+
+        cmd="${${_supervisorctl_cmds[(r)$words[1]:*]%%:*}:-${(k)_supervisorctl_syns[(r)(*:|)$words[1](:*|)]}}"
+        if (( $#cmd )); then
+          curcontext="${curcontext%:*:*}:supervisorctl-${cmd}:"
+          _call_function ret _supervisorctl_$cmd || _message 'no more arguments'
+        else
+          _message "unknown supervisorctl command: $words[1]"
+        fi
+        return ret
+    fi
+}
+
+# get supervisor contoroll processes
+(( $+functions[_get_supervisor_procs] )) ||
+_get_supervisor_procs() {
+    _supervisor_procs=(${${(f)"$(supervisorctl status >/dev/null 2>&1 | awk -F' ' '{print $1}')"}})
+    compadd -a _supervisor_procs
+}
+
+(( $+functions[_supervisorctl_add] )) ||
+_supervisorctl_add() {
+    _arguments -s \
+        "--help[use help system]" \
+        "*::supervisorctl commands:_supervisorctl"
+}
+
+(( $+functions[_supervisorctl_help] )) ||
+_supervisorctl_help() {
+    _arguments -s \
+        "*:supervisorctl commands:_supervisorctl"
+}
+
+(( $+functions[_supervisorctl_maintail] )) ||
+_supervisorctl_maintail() {
+    _arguments -s \
+        '-f[Continuous tail of supervisor main log file (Ctrl-C to exit)]'
+}
+
+(( $+functions[_supervisorctl_start] )) ||
+_supervisorctl_start() {
+    # TODO: add 'all'
+    _arguments -s \
+        '*::supvervisor process:_get_supervisor_procs'
+}
+
+(( $+functions[_supervisorctl_status] )) ||
+_supervisorctl_status() {
+    _arguments \
+        '*::supvervisor process:_get_supervisor_procs'
+}
+
+(( $+functions[_supervisorctl_stop] )) ||
+_supervisorctl_stop() {
+    # TODO: add 'all'
+    _arguments -s \
+        '*::supvervisor process:_get_supervisor_procs'
+}
+
+(( $+functions[_supervisorctl_tail] )) ||
+_supervisorctl_tail() {
+    # TODO: add 'stderr'
+    _arguments -s \
+        '-f[Continuous tail of named process stdout Ctrl-C to exit.]' \
+        '*::supvervisor process:_get_supervisor_procs'
+}
+
+_supervisorctl "$@"

File _supervisord

+#compdef supervisord
+
+typeset -A opt_args
+local context state line
+
+    _arguments -s -S \
+        "-c[configuration file]::FILENAME:_files" \
+        "--configuration[configuration file]:FILENAME:_files" \
+        "-n[run in the foreground (same as 'nodaemon true' in config file)]" \
+        "--nodaemon[run in the foreground (same as 'nodaemon true' in config file)]" \
+        "-h[print this usage message and exit]:" \
+        "--help[print this usage message and exit]:" \
+        "-u[run supervisord as this user]:USER:_users" \
+        "--user[run supervisord as this user]::USER:_users" \
+        "-m[use this umask for daemon subprocess (default is 022)]" \
+        "--umask[use this umask for daemon subprocess (default is 022)]" \
+        "-d[directory to chdir to when daemonized]" \
+        "--directory[directory to chdir to when daemonized]" \
+        "-l[use FILENAME as logfile path]::FILENAME:_files" \
+        "--logfile[use FILENAME as logfile path]::FILENAME:_files" \
+        "-y[use BYTES to limit the max size of logfile]" \
+        "--logfile_maxbytes[use BYTES to limit the max size of logfile]" \
+        "-z[number of backups to keep when max bytes reached]" \
+        "--logfile_backups[number of backups to keep when max bytes reached]" \
+        "-e[use LEVEL as log level (debug,info,warn,error,critical)]" \
+        "--loglevel[use LEVEL as log level (debug,info,warn,error,critical)]" \
+        "-j[write a pid file for the daemon process to FILENAME]" \
+        "--pidfile[write a pid file for the daemon process to FILENAME]" \
+        "-i[identifier used for this instance of supervisord]" \
+        "--identifier[identifier used for this instance of supervisord]" \
+        "-q[the log directory for child process logs]" \
+        "--childlogdir[the log directory for child process logs]" \
+        "-k[prevent the process from performing cleanup (removal of old automatic child log files) at startup.]" \
+        "--nocleanup[prevent the process from performing cleanup (removal of old automatic child log files) at startup.]" \
+        "-a[the minimum number of file descriptors for start success]" \
+        "--minfds[the minimum number of file descriptors for start success]" \
+        "-t[strip ansi escape codes from process output]" \
+        "--strip_ansi[strip ansi escape codes from process output]" \
+        "--minprocs[the minimum number of processes available for start success]" \
+        "--profile_options[run supervisord under profiler and output results based on OPTIONS, which is a comma-sep'd list of 'cumulative', 'calls', and/or 'callers', e.g. 'cumulative,callers')]" \
+        "*::USERNAME:_users"