From 51a3b7263409f73c0992d39e50f514540fa2878b Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Mon, 23 Dec 2019 16:44:28 +0000 Subject: [PATCH 1/3] zsh: Group systemctl subcommands as in the manual. No functional change. --- shell-completion/zsh/_systemctl.in | 41 ++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/shell-completion/zsh/_systemctl.in b/shell-completion/zsh/_systemctl.in index 67c1c2b327..b6adce85e6 100644 --- a/shell-completion/zsh/_systemctl.in +++ b/shell-completion/zsh/_systemctl.in @@ -5,6 +5,7 @@ { local -a _systemctl_cmds _systemctl_cmds=( + # Unit Commands "list-sockets:List sockets" "list-timers:List timers" "list-units:List units" @@ -16,9 +17,6 @@ "try-restart:Restart one or more units if active" "reload-or-restart:Reload one or more units if possible, otherwise start or restart" "force-reload:Reload one or more units if possible, otherwise restart if active" - "hibernate:Hibernate the system" - "hybrid-sleep:Hibernate and suspend the system" - "suspend-then-hibernate:Suspend the system for a period of time, and then hibernate it" "try-reload-or-restart:Reload one or more units if possible, otherwise restart if active" "isolate:Start one unit and stop all others" "kill:Send signal to processes of a unit" @@ -27,32 +25,44 @@ "status:Show runtime status of one or more units" "show:Show properties of one or more units/jobs or the manager" "cat:Show the source unit files and drop-ins" + "set-property:Sets one or more properties of a unit" + "help:Show documentation for specified units" "reset-failed:Reset failed state for all, one, or more units" + "list-dependencies:Show unit dependency tree" + + # Unit File Commands "list-unit-files:List installed unit files" "enable:Enable one or more unit files" "disable:Disable one or more unit files" - "add-wants:Add Wants= dependencies to a unit" - "add-requires:Add Requires= dependencies to a unit" "reenable:Reenable one or more unit files" "preset:Enable/disable one or more unit files based on preset configuration" "preset-all:Enable/disable all unit files based on preset configuration" - "set-default:Set the default target" - "get-default:Query the default target" - "edit:Edit one or more unit files" - "is-system-running:Query overall status of the system" - "help:Show documentation for specified units" - "list-dependencies:Show unit dependency tree" + "is-enabled:Check whether unit files are enabled" "mask:Mask one or more units" "unmask:Unmask one or more units" "link:Link one or more units files into the search path" - "is-enabled:Check whether unit files are enabled" + "revert:Revert unit files to their vendor versions" + "add-wants:Add Wants= dependencies to a unit" + "add-requires:Add Requires= dependencies to a unit" + "set-default:Set the default target" + "get-default:Query the default target" + "edit:Edit one or more unit files" + + # Job Commands "list-jobs:List jobs" "cancel:Cancel all, one, or more jobs" + + # Environment Commands "show-environment:Dump environment" "set-environment:Set one or more environment variables" "unset-environment:Unset one or more environment variables" + + # Manager State Commands "daemon-reload:Reload systemd manager configuration" "daemon-reexec:Reexecute systemd manager" + + # System Commands + "is-system-running:Query overall status of the system" "default:Enter system default mode" "rescue:Enter system rescue mode" "emergency:Enter system emergency mode" @@ -63,8 +73,11 @@ "kexec:Shut down and reboot the system with kexec" "exit:Ask for user instance termination" "switch-root:Change root directory" - "revert:Revert unit files to their vendor versions" - "set-property:Sets one or more properties of a unit" + "hibernate:Hibernate the system" + "hybrid-sleep:Hibernate and suspend the system" + "suspend-then-hibernate:Suspend the system for a period of time, and then hibernate it" + + # (Add new commands to the appropriate category, not here.) ) if (( CURRENT == 1 )); then From 1d8385b4159961c6b888700aa98c6897ac21e47b Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Mon, 23 Dec 2019 16:49:51 +0000 Subject: [PATCH 2/3] zsh: Complete more systemctl commands The completion is now synced with the manual. --- shell-completion/zsh/_systemctl.in | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/shell-completion/zsh/_systemctl.in b/shell-completion/zsh/_systemctl.in index b6adce85e6..d7969823cd 100644 --- a/shell-completion/zsh/_systemctl.in +++ b/shell-completion/zsh/_systemctl.in @@ -29,6 +29,10 @@ "help:Show documentation for specified units" "reset-failed:Reset failed state for all, one, or more units" "list-dependencies:Show unit dependency tree" + "clean:Remove configuration, state, cache, logs or runtime data of units" + + # Machine Commands + "list-machines:List the host and all running local containers" # Unit File Commands "list-unit-files:List installed unit files" @@ -56,10 +60,14 @@ "show-environment:Dump environment" "set-environment:Set one or more environment variables" "unset-environment:Unset one or more environment variables" + "import-environment:Import environment variables set on the client" # Manager State Commands "daemon-reload:Reload systemd manager configuration" "daemon-reexec:Reexecute systemd manager" + "log-level:Get or set the log level" + "log-target:Get or set the log target" + "service-watchdogs:Get or set the state of software watchdogs" # System Commands "is-system-running:Query overall status of the system" From fa7ea8651084d3ba6f25b8c78c451e073bff20d3 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Mon, 23 Dec 2019 17:17:31 +0000 Subject: [PATCH 3/3] zsh: Prepare for classifying systemctl commands (#14422) --- shell-completion/zsh/_systemctl.in | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/shell-completion/zsh/_systemctl.in b/shell-completion/zsh/_systemctl.in index d7969823cd..18663fca2e 100644 --- a/shell-completion/zsh/_systemctl.in +++ b/shell-completion/zsh/_systemctl.in @@ -3,8 +3,7 @@ (( $+functions[_systemctl_commands] )) || _systemctl_commands() { - local -a _systemctl_cmds - _systemctl_cmds=( + local -a unit_commands=( # Unit Commands "list-sockets:List sockets" "list-timers:List timers" @@ -30,10 +29,14 @@ "reset-failed:Reset failed state for all, one, or more units" "list-dependencies:Show unit dependency tree" "clean:Remove configuration, state, cache, logs or runtime data of units" + ) + local -a machine_commands=( # Machine Commands "list-machines:List the host and all running local containers" + ) + local -a unit_file_commands=( # Unit File Commands "list-unit-files:List installed unit files" "enable:Enable one or more unit files" @@ -51,24 +54,32 @@ "set-default:Set the default target" "get-default:Query the default target" "edit:Edit one or more unit files" + ) + local -a job_commands=( # Job Commands "list-jobs:List jobs" "cancel:Cancel all, one, or more jobs" + ) + local -a environment_commands=( # Environment Commands "show-environment:Dump environment" "set-environment:Set one or more environment variables" "unset-environment:Unset one or more environment variables" "import-environment:Import environment variables set on the client" + ) + local -a manager_state_commands=( # Manager State Commands "daemon-reload:Reload systemd manager configuration" "daemon-reexec:Reexecute systemd manager" "log-level:Get or set the log level" "log-target:Get or set the log target" "service-watchdogs:Get or set the state of software watchdogs" + ) + local -a system_commands=( # System Commands "is-system-running:Query overall status of the system" "default:Enter system default mode" @@ -84,8 +95,16 @@ "hibernate:Hibernate the system" "hybrid-sleep:Hibernate and suspend the system" "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