|
Zbigniew Jędrzejewski-Szmek |
96237b |
From 191479e0e4fb43f667ce743e82aac8bcccfbd6e1 Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
From: Thomas Hindoe Paaboel Andersen <phomes@gmail.com>
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
Date: Mon, 3 Mar 2014 22:16:04 +0100
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
Subject: [PATCH] add bash completion for systemd-detect-virt
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
(cherry picked from commit 3bfe58cbd4a9b1d2520f425f95de718f3a583d39)
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
---
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
Makefile.am | 1 +
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
shell-completion/bash/systemd-detect-virt | 40 +++++++++++++++++++++++++++++++
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
2 files changed, 41 insertions(+)
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
create mode 100644 shell-completion/bash/systemd-detect-virt
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
diff --git a/Makefile.am b/Makefile.am
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
index bc5e719..834ed6f 100644
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
--- a/Makefile.am
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+++ b/Makefile.am
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
@@ -355,6 +355,7 @@ dist_bashcompletion_DATA = \
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
shell-completion/bash/systemd-cgls \
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
shell-completion/bash/systemd-cgtop \
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
shell-completion/bash/systemd-delta \
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+ shell-completion/bash/systemd-detect-virt \
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
shell-completion/bash/systemd-nspawn \
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
shell-completion/bash/systemd-run \
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
shell-completion/bash/udevadm \
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
diff --git a/shell-completion/bash/systemd-detect-virt b/shell-completion/bash/systemd-detect-virt
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
new file mode 100644
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
index 0000000..df06c29
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
--- /dev/null
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+++ b/shell-completion/bash/systemd-detect-virt
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
@@ -0,0 +1,40 @@
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+# systemd-detect-virt(1) completion -*- shell-script -*-
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+#
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+# This file is part of systemd.
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+#
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+# Copyright 2014 Thomas H.P. Andersen
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+#
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+# systemd is free software; you can redistribute it and/or modify it
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+# under the terms of the GNU Lesser General Public License as published by
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+# the Free Software Foundation; either version 2.1 of the License, or
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+# (at your option) any later version.
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+#
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+# systemd is distributed in the hope that it will be useful, but
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+# General Public License for more details.
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+#
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+# You should have received a copy of the GNU Lesser General Public License
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+# along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+__contains_word() {
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+ local w word=$1; shift
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+ for w in "$@"; do
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+ [[ $w = "$word" ]] && return
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+ done
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+}
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+_systemd_detect_virt() {
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+ local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+ local i verb comps
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+ local -A OPTS=(
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+ [STANDALONE]='-h --help --version -c --container -v --vm -q --quiet'
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+ )
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+ _init_completion || return
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+ COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+}
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+complete -F _systemd_detect_virt systemd-detect-virt
|