richardphibel / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
Blob Blame History Raw
From 15e2a6ebee7eab4a9b2ef57082e949ead17cdd85 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Thu, 2 Apr 2015 22:54:35 -0400
Subject: [PATCH] shell-completion: systemctl switch-root verb

The completion is rudimentary (all files). I think this is OK since
this is used so rarely. But not having it proposed at all is annoying.

(cherry picked from commit 7b742b3130941b5c8d5e178b6694428fb3b61086)

Cherry-picked from: 166cee1
Resolves: #1222517
---
 shell-completion/bash/systemctl.in | 2 +-
 shell-completion/zsh/_systemctl.in | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/shell-completion/bash/systemctl.in b/shell-completion/bash/systemctl.in
index 8063316ec6..3d787cdb77 100644
--- a/shell-completion/bash/systemctl.in
+++ b/shell-completion/bash/systemctl.in
@@ -160,7 +160,7 @@ _systemctl () {
                              reboot rescue show-environment suspend get-default
                              is-system-running'
                      [NAME]='snapshot'
-                     [FILE]='link'
+                     [FILE]='link switch-root'
                   [TARGETS]='set-default'
         )
 
diff --git a/shell-completion/zsh/_systemctl.in b/shell-completion/zsh/_systemctl.in
index 7f2d5ac0fa..82edfd3d74 100644
--- a/shell-completion/zsh/_systemctl.in
+++ b/shell-completion/zsh/_systemctl.in
@@ -59,6 +59,7 @@
     "reboot:Shut down and reboot the system"
     "kexec:Shut down and reboot the system with kexec"
     "exit:Ask for user instance termination"
+    "switch-root:Change root directory"
   )
 
   if (( CURRENT == 1 )); then
@@ -297,6 +298,10 @@ done
    _sd_unit_files
 }
 
+(( $+functions[_systemctl_switch-root] )) || _systemctl_switch-root() {
+   _files
+}
+
 # no systemctl completion for:
 #    [STANDALONE]='daemon-reexec daemon-reload default
 #                  emergency exit halt kexec list-jobs list-units