daandemeyer / rpms / systemd

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