summaryrefslogtreecommitdiffstats
path: root/src/tools/ceph-lazy/bash_completion.d
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
commit483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch)
treee5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/tools/ceph-lazy/bash_completion.d
parentInitial commit. (diff)
downloadceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.tar.xz
ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.zip
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/tools/ceph-lazy/bash_completion.d')
-rw-r--r--src/tools/ceph-lazy/bash_completion.d/ceph-lazy27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/tools/ceph-lazy/bash_completion.d/ceph-lazy b/src/tools/ceph-lazy/bash_completion.d/ceph-lazy
new file mode 100644
index 00000000..4429def4
--- /dev/null
+++ b/src/tools/ceph-lazy/bash_completion.d/ceph-lazy
@@ -0,0 +1,27 @@
+_ceph-lazy()
+{
+ local cur prev all_opts commands
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+ commands="host-get-osd host-get-nodes host-osd-usage host-all-usage pg-get-host pg-most-write pg-less-write pg-most-write-kb pg-less-write-kb pg-most-read pg-less-read pg-most-read-kb pg-less-read-kb pg-empty rbd-prefix rbd-count rbd-host rbd-osd rbd-size rbd-all-size osd-most-used osd-less-used osd-get-ppg osd-get-pg object-get-host"
+
+ all_opts="$commands -d -h"
+
+
+
+# If first option is -d keep completing without -d & -h
+ if [[ ${prev} == "-d" && ${#COMP_WORDS[@]} -eq 3 ]] ; then
+ COMPREPLY=( $(compgen -W "${commands}" -- ${cur}) )
+ return 0
+# Do completion for first args
+ elif [[ ${#COMP_WORDS[@]} -eq 2 ]]; then
+ COMPREPLY=( $(compgen -W "${all_opts}" -- ${cur}) )
+ return 0
+# Else do nothing
+ else
+ return 0
+ fi
+}
+complete -F _ceph-lazy ceph-lazy