richardphibel / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
1ff636
From 15e2a6ebee7eab4a9b2ef57082e949ead17cdd85 Mon Sep 17 00:00:00 2001
1ff636
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
1ff636
Date: Thu, 2 Apr 2015 22:54:35 -0400
1ff636
Subject: [PATCH] shell-completion: systemctl switch-root verb
1ff636
1ff636
The completion is rudimentary (all files). I think this is OK since
1ff636
this is used so rarely. But not having it proposed at all is annoying.
1ff636
1ff636
(cherry picked from commit 7b742b3130941b5c8d5e178b6694428fb3b61086)
1ff636
1ff636
Cherry-picked from: 166cee1
1ff636
Resolves: #1222517
1ff636
---
1ff636
 shell-completion/bash/systemctl.in | 2 +-
1ff636
 shell-completion/zsh/_systemctl.in | 5 +++++
1ff636
 2 files changed, 6 insertions(+), 1 deletion(-)
1ff636
1ff636
diff --git a/shell-completion/bash/systemctl.in b/shell-completion/bash/systemctl.in
1ff636
index 8063316..3d787cd 100644
1ff636
--- a/shell-completion/bash/systemctl.in
1ff636
+++ b/shell-completion/bash/systemctl.in
1ff636
@@ -160,7 +160,7 @@ _systemctl () {
1ff636
                              reboot rescue show-environment suspend get-default
1ff636
                              is-system-running'
1ff636
                      [NAME]='snapshot'
1ff636
-                     [FILE]='link'
1ff636
+                     [FILE]='link switch-root'
1ff636
                   [TARGETS]='set-default'
1ff636
         )
1ff636
 
1ff636
diff --git a/shell-completion/zsh/_systemctl.in b/shell-completion/zsh/_systemctl.in
1ff636
index 7f2d5ac..82edfd3 100644
1ff636
--- a/shell-completion/zsh/_systemctl.in
1ff636
+++ b/shell-completion/zsh/_systemctl.in
1ff636
@@ -59,6 +59,7 @@
1ff636
     "reboot:Shut down and reboot the system"
1ff636
     "kexec:Shut down and reboot the system with kexec"
1ff636
     "exit:Ask for user instance termination"
1ff636
+    "switch-root:Change root directory"
1ff636
   )
1ff636
 
1ff636
   if (( CURRENT == 1 )); then
1ff636
@@ -297,6 +298,10 @@ done
1ff636
    _sd_unit_files
1ff636
 }
1ff636
 
1ff636
+(( $+functions[_systemctl_switch-root] )) || _systemctl_switch-root() {
1ff636
+   _files
1ff636
+}
1ff636
+
1ff636
 # no systemctl completion for:
1ff636
 #    [STANDALONE]='daemon-reexec daemon-reload default
1ff636
 #                  emergency exit halt kexec list-jobs list-units