zsh: Prepare for classifying systemctl commands (#14422)

This commit is contained in:
Daniel Shahaf 2019-12-23 17:17:31 +00:00
parent 1d8385b415
commit fa7ea86510
1 changed files with 22 additions and 3 deletions

View File

@ -3,8 +3,7 @@
(( $+functions[_systemctl_commands] )) || _systemctl_commands() (( $+functions[_systemctl_commands] )) || _systemctl_commands()
{ {
local -a _systemctl_cmds local -a unit_commands=(
_systemctl_cmds=(
# Unit Commands # Unit Commands
"list-sockets:List sockets" "list-sockets:List sockets"
"list-timers:List timers" "list-timers:List timers"
@ -30,10 +29,14 @@
"reset-failed:Reset failed state for all, one, or more units" "reset-failed:Reset failed state for all, one, or more units"
"list-dependencies:Show unit dependency tree" "list-dependencies:Show unit dependency tree"
"clean:Remove configuration, state, cache, logs or runtime data of units" "clean:Remove configuration, state, cache, logs or runtime data of units"
)
local -a machine_commands=(
# Machine Commands # Machine Commands
"list-machines:List the host and all running local containers" "list-machines:List the host and all running local containers"
)
local -a unit_file_commands=(
# Unit File Commands # Unit File Commands
"list-unit-files:List installed unit files" "list-unit-files:List installed unit files"
"enable:Enable one or more unit files" "enable:Enable one or more unit files"
@ -51,24 +54,32 @@
"set-default:Set the default target" "set-default:Set the default target"
"get-default:Query the default target" "get-default:Query the default target"
"edit:Edit one or more unit files" "edit:Edit one or more unit files"
)
local -a job_commands=(
# Job Commands # Job Commands
"list-jobs:List jobs" "list-jobs:List jobs"
"cancel:Cancel all, one, or more jobs" "cancel:Cancel all, one, or more jobs"
)
local -a environment_commands=(
# Environment Commands # Environment Commands
"show-environment:Dump environment" "show-environment:Dump environment"
"set-environment:Set one or more environment variables" "set-environment:Set one or more environment variables"
"unset-environment:Unset one or more environment variables" "unset-environment:Unset one or more environment variables"
"import-environment:Import environment variables set on the client" "import-environment:Import environment variables set on the client"
)
local -a manager_state_commands=(
# Manager State Commands # Manager State Commands
"daemon-reload:Reload systemd manager configuration" "daemon-reload:Reload systemd manager configuration"
"daemon-reexec:Reexecute systemd manager" "daemon-reexec:Reexecute systemd manager"
"log-level:Get or set the log level" "log-level:Get or set the log level"
"log-target:Get or set the log target" "log-target:Get or set the log target"
"service-watchdogs:Get or set the state of software watchdogs" "service-watchdogs:Get or set the state of software watchdogs"
)
local -a system_commands=(
# System Commands # System Commands
"is-system-running:Query overall status of the system" "is-system-running:Query overall status of the system"
"default:Enter system default mode" "default:Enter system default mode"
@ -84,8 +95,16 @@
"hibernate:Hibernate the system" "hibernate:Hibernate the system"
"hybrid-sleep:Hibernate and suspend the system" "hybrid-sleep:Hibernate and suspend the system"
"suspend-then-hibernate:Suspend the system for a period of time, and then hibernate it" "suspend-then-hibernate:Suspend the system for a period of time, and then hibernate it"
)
# (Add new commands to the appropriate category, not here.) local -a _systemctl_cmds=(
"${unit_commands[@]}"
"${machine_commands[@]}"
"${unit_file_commands[@]}"
"${job_commands[@]}"
"${environment_commands[@]}"
"${manager_state_commands[@]}"
"${system_commands[@]}"
) )
if (( CURRENT == 1 )); then if (( CURRENT == 1 )); then