|
Zbigniew Jędrzejewski-Szmek |
96237b |
From 6b4293393eb0a15e4f73ba9f08554178ccc4c222 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: Sun, 2 Mar 2014 22:58:18 +0100
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
Subject: [PATCH] add bash completion for systemd-cgtop
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
(cherry picked from commit d9256bac4da4241cb5d97960c899390839f2c6e5)
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
---
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
Makefile.am | 1 +
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
shell-completion/bash/systemd-cgtop | 40 +++++++++++++++++++++++++++++++++++++
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
2 files changed, 41 insertions(+)
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
create mode 100644 shell-completion/bash/systemd-cgtop
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
diff --git a/Makefile.am b/Makefile.am
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
index 0b83823..9cabd1d 100644
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
--- a/Makefile.am
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+++ b/Makefile.am
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
@@ -353,6 +353,7 @@ dist_bashcompletion_DATA = \
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
shell-completion/bash/systemctl \
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
shell-completion/bash/systemd-analyze \
|
|
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-nspawn \
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
shell-completion/bash/systemd-run \
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
diff --git a/shell-completion/bash/systemd-cgtop b/shell-completion/bash/systemd-cgtop
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
new file mode 100644
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
index 0000000..d7ea42d
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
--- /dev/null
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+++ b/shell-completion/bash/systemd-cgtop
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
@@ -0,0 +1,40 @@
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+# systemd-cgtop(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_cgtop() {
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+ local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+ local comps
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+ local -A OPTS=(
|
|
Zbigniew Jędrzejewski-Szmek |
96237b |
+ [STANDALONE]='-h --help --version -p -t -c -m -i -b --batch -n --iterations -d --delay'
|
|
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_cgtop systemd-cgtop
|