basebuilder_pel7ppc64bebuilder0
7 years ago
1 changed files with 92 additions and 0 deletions
@ -0,0 +1,92 @@
@@ -0,0 +1,92 @@
|
||||
From 0b8ef4d8289fa1af0296ae01faf0e60293c725fd Mon Sep 17 00:00:00 2001 |
||||
From: Karel Zak <kzak@redhat.com> |
||||
Date: Wed, 22 Mar 2017 12:13:43 +0100 |
||||
Subject: [PATCH] zramctl: add bash completion |
||||
|
||||
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1358755 |
||||
Signed-off-by: Karel Zak <kzak@redhat.com> |
||||
--- |
||||
bash-completion/Makemodule.am | 3 ++- |
||||
bash-completion/zramctl | 57 +++++++++++++++++++++++++++++++++++++++++++ |
||||
2 files changed, 59 insertions(+), 1 deletion(-) |
||||
create mode 100644 bash-completion/zramctl |
||||
|
||||
diff --git a/bash-completion/Makemodule.am b/bash-completion/Makemodule.am |
||||
index c3791e7..84ab258 100644 |
||||
--- a/bash-completion/Makemodule.am |
||||
+++ b/bash-completion/Makemodule.am |
||||
@@ -30,7 +30,8 @@ dist_bashcompletion_DATA = \ |
||||
bash-completion/setsid \ |
||||
bash-completion/tailf \ |
||||
bash-completion/whereis \ |
||||
- bash-completion/wipefs |
||||
+ bash-completion/wipefs \ |
||||
+ bash-completion/zramctl |
||||
|
||||
# disk-utils... |
||||
if BUILD_BFS |
||||
diff --git a/bash-completion/zramctl b/bash-completion/zramctl |
||||
new file mode 100644 |
||||
index 0000000..a4ef536 |
||||
--- /dev/null |
||||
+++ b/bash-completion/zramctl |
||||
@@ -0,0 +1,57 @@ |
||||
+_zramctl_module() |
||||
+{ |
||||
+ local cur prev OPTS |
||||
+ COMPREPLY=() |
||||
+ cur="${COMP_WORDS[COMP_CWORD]}" |
||||
+ prev="${COMP_WORDS[COMP_CWORD-1]}" |
||||
+ case $prev in |
||||
+ '-a'|'--algorithm') |
||||
+ COMPREPLY=( $(compgen -W "lzo lz4" -- $cur) ) |
||||
+ return 0 |
||||
+ ;; |
||||
+ '-o'|'--output') |
||||
+ local prefix realcur OUTPUT_ALL OUTPUT |
||||
+ realcur="${cur##*,}" |
||||
+ prefix="${cur%$realcur}" |
||||
+ OUTPUT_ALL="NAME DISKSIZE DATA COMPR ALGORITHM STREAMS ZERO-PAGES TOTAL MOUNTPOINT" |
||||
+ for WORD in $OUTPUT_ALL; do |
||||
+ if ! [[ $prefix == *"$WORD"* ]]; then |
||||
+ OUTPUT="$WORD $OUTPUT" |
||||
+ fi |
||||
+ done |
||||
+ compopt -o nospace |
||||
+ COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) ) |
||||
+ return 0 |
||||
+ ;; |
||||
+ '-s'|'--size') |
||||
+ COMPREPLY=( $(compgen -W "size" -- $cur) ) |
||||
+ return 0 |
||||
+ ;; |
||||
+ '-t'|'--streams') |
||||
+ COMPREPLY=( $(compgen -W "number" -- $cur) ) |
||||
+ return 0 |
||||
+ ;; |
||||
+ esac |
||||
+ case $cur in |
||||
+ -*) |
||||
+ OPTS=" --algorithm |
||||
+ --bytes |
||||
+ --find |
||||
+ --noheadings |
||||
+ --output |
||||
+ --raw |
||||
+ --reset |
||||
+ --size |
||||
+ --streams |
||||
+ --help |
||||
+ --version" |
||||
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) |
||||
+ return 0 |
||||
+ ;; |
||||
+ esac |
||||
+ local IFS=$'\n' |
||||
+ compopt -o filenames |
||||
+ COMPREPLY=( $(compgen -f -- ${cur:-"/dev/zram"}) ) |
||||
+ return 0 |
||||
+} |
||||
+complete -F _zramctl_module zramctl |
||||
-- |
||||
2.9.3 |
Loading…
Reference in new issue