All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Add BASH completion for various tools
@ 2011-06-28 18:28 Wido den Hollander
  2011-06-28 18:28 ` [PATCH 1/3] bash_completion: Add bash completion for ceph, rados, radosgw_admin and rbd Wido den Hollander
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Wido den Hollander @ 2011-06-28 18:28 UTC (permalink / raw)
  To: ceph-devel

Hi,

BASH completion is very useful when working with the common Ceph tools on a regular basis.

It also makes it easier for new users to quickly find out some "hidden" commands the "ceph" tool has.

I made a start with the BASH completion for the most used tools, ceph, rados, radosgw_admin and rbd.

They are not complete yet, they'll have to take shape over time.

I've been playing with complementing pool names to the -p argument of the rados and rbd tool, but this causes "rados lspools" to be ran in the background.
I'm not sure yet what kind of performance impact this could have when you have a large amount of pools.

Let me know what you guys think of it.

Wido


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] bash_completion: Add bash completion for ceph, rados, radosgw_admin and rbd
  2011-06-28 18:28 [PATCH 0/3] Add BASH completion for various tools Wido den Hollander
@ 2011-06-28 18:28 ` Wido den Hollander
  2011-06-28 18:28 ` [PATCH 2/3] bash_completion: Add the bash_completion files to the Debian packages Wido den Hollander
  2011-06-28 18:28 ` [PATCH 3/3] bash_completion: Add to the Makefile Wido den Hollander
  2 siblings, 0 replies; 4+ messages in thread
From: Wido den Hollander @ 2011-06-28 18:28 UTC (permalink / raw)
  To: ceph-devel; +Cc: Wido den Hollander


Signed-off-by: Wido den Hollander <wido@widodh.nl>
---
 src/bash_completion/ceph          |   60 +++++++++++++++++++++++++++++++++++++
 src/bash_completion/rados         |   40 ++++++++++++++++++++++++
 src/bash_completion/radosgw_admin |   57 +++++++++++++++++++++++++++++++++++
 src/bash_completion/rbd           |   44 +++++++++++++++++++++++++++
 4 files changed, 201 insertions(+), 0 deletions(-)
 create mode 100644 src/bash_completion/ceph
 create mode 100644 src/bash_completion/rados
 create mode 100644 src/bash_completion/radosgw_admin
 create mode 100644 src/bash_completion/rbd

diff --git a/src/bash_completion/ceph b/src/bash_completion/ceph
new file mode 100644
index 0000000..f7ec55b
--- /dev/null
+++ b/src/bash_completion/ceph
@@ -0,0 +1,60 @@
+#
+# Ceph - scalable distributed file system
+#
+# Copyright (C) 2011 Wido den Hollander <wido@widodh.nl>
+#
+# This is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software
+# Foundation.  See file COPYING.
+#
+
+_ceph()
+{
+        local cur prev
+
+        COMPREPLY=()
+        cur="${COMP_WORDS[COMP_CWORD]}"
+        prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+        if [[ ${cur} == -* ]] ; then
+            COMPREPLY=( $(compgen -W "--conf -c --name --id -m --version -s --status -w --watch -o --out-file -i --in-file" -- ${cur}) )
+            return 0
+        fi
+
+        case "${prev}" in
+            -o | --out-file | -i | --in-file | --conf | -c)
+                COMPREPLY=( $(compgen -f ${cur}) )
+                return 0
+                ;;
+            -m)
+                COMPREPLY=( $(compgen -A hostname ${cur}) )
+                return 0
+                ;;
+            auth)
+                COMPREPLY=( $(compgen -W "list add del" -- ${cur}) )
+                return 0
+                ;;
+            pg)
+                COMPREPLY=( $(compgen -W "stat dump getmap map send_pg_creates scrub repair" -- ${cur}) )
+                return 0
+                ;;
+            osd)
+                COMPREPLY=( $(compgen -W "tell stat injectargs pool dump getmaxosd tree getmap getcrushmap lspools" -- ${cur}) )
+                return 0
+                ;;
+            mon)
+                COMPREPLY=( $(compgen -W "tell stat injectargs getmap" -- ${cur}) )
+                return 0
+                ;;
+            mds)
+                COMPREPLY=( $(compgen -W "tell stat injectargs stat getmap dump compat" -- ${cur}) )
+                return 0
+                ;;
+            *)
+                COMPREPLY=( $(compgen -W "osd mon mds pg auth" -- ${cur}) )
+                return 0
+            ;;
+        esac
+}
+complete -F _ceph ceph
diff --git a/src/bash_completion/rados b/src/bash_completion/rados
new file mode 100644
index 0000000..aa277c3
--- /dev/null
+++ b/src/bash_completion/rados
@@ -0,0 +1,40 @@
+#
+# Ceph - scalable distributed file system
+#
+# Copyright (C) 2011 Wido den Hollander <wido@widodh.nl>
+#
+# This is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software
+# Foundation.  See file COPYING.
+#
+
+_rados()
+{
+        local cur prev
+
+        COMPREPLY=()
+        cur="${COMP_WORDS[COMP_CWORD]}"
+        prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+        if [[ ${cur} == -* ]] ; then
+            COMPREPLY=( $(compgen -W "-c --conf -m -d -f -p --pool -b --snap -i -o --create" -- ${cur}) )
+            return 0
+        fi
+
+        case "${prev}" in
+            --conf | -c | -o | -i)
+                COMPREPLY=( $(compgen -f ${cur}) )
+                return 0
+                ;;
+            -m)
+                COMPREPLY=( $(compgen -A hostname ${cur}) )
+                return 0
+                ;;
+            *)
+                COMPREPLY=( $(compgen -W "lspools mkpool rmpool df ls chown get put create rm listxattr getxattr setxattr rmxattr stat mapext lssnap mksnap rmsnap rollback bench" -- ${cur}) )
+                return 0
+            ;;
+        esac
+}
+complete -F _rados rados
diff --git a/src/bash_completion/radosgw_admin b/src/bash_completion/radosgw_admin
new file mode 100644
index 0000000..1583e91
--- /dev/null
+++ b/src/bash_completion/radosgw_admin
@@ -0,0 +1,57 @@
+#
+# Ceph - scalable distributed file system
+#
+# Copyright (C) 2011 Wido den Hollander <wido@widodh.nl>
+#
+# This is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software
+# Foundation.  See file COPYING.
+#
+
+_radosgw_admin()
+{
+        local cur prev
+
+        COMPREPLY=()
+        cur="${COMP_WORDS[COMP_CWORD]}"
+        prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+        if [[ ${cur} == -* ]] ; then
+            COMPREPLY=( $(compgen -W "--uid --subuser --access-key --os-user --email --auth_uid --secret --os-secret --gen-access-key --gen-secret \
+                                      --access --display-name --bucket --object --date --conf --name --id --version -s -w" -- ${cur}) )
+            return 0
+        fi
+
+        case "${prev}" in
+            --conf | -c)
+                COMPREPLY=( $(compgen -f ${cur}) )
+                return 0
+                ;;
+            -m)
+                COMPREPLY=( $(compgen -A hostname ${cur}) )
+                return 0
+                ;;
+            user)
+                COMPREPLY=( $(compgen -W "create modify info rm" -- ${cur}) )
+                return 0
+                ;;
+            subuser)
+                COMPREPLY=( $(compgen -W "create modify rm" -- ${cur}) )
+                return 0
+                ;;
+            key)
+                COMPREPLY=( $(compgen -W "create rm" -- ${cur}) )
+                return 0
+                ;;
+            buckets)
+                COMPREPLY=( $(compgen -W "list unlink" -- ${cur}) )
+                return 0
+                ;;
+            *)
+                COMPREPLY=( $(compgen -W "user subuser key buckets policy log" -- ${cur}) )
+                return 0
+            ;;
+        esac
+}
+complete -F _radosgw_admin radosgw_admin
diff --git a/src/bash_completion/rbd b/src/bash_completion/rbd
new file mode 100644
index 0000000..5b6ec0e
--- /dev/null
+++ b/src/bash_completion/rbd
@@ -0,0 +1,44 @@
+#
+# Ceph - scalable distributed file system
+#
+# Copyright (C) 2011 Wido den Hollander <wido@widodh.nl>
+#
+# This is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software
+# Foundation.  See file COPYING.
+#
+
+_rbd()
+{
+        local cur prev
+
+        COMPREPLY=()
+        cur="${COMP_WORDS[COMP_CWORD]}"
+        prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+        if [[ ${cur} == -* ]] ; then
+            COMPREPLY=( $(compgen -W "-c --conf -m -d -f -p --pool --snap -i -o --image --dest --dest-pool --path --size --user --secret" -- ${cur}) )
+            return 0
+        fi
+
+        case "${prev}" in
+            --conf | -c | --path | --secret)
+                COMPREPLY=( $(compgen -f ${cur}) )
+                return 0
+                ;;
+            -m)
+                COMPREPLY=( $(compgen -A hostname ${cur}) )
+                return 0
+                ;;
+            snap)
+                COMPREPLY=( $(compgen -W "ls create rollback rm" -- ${cur}) )
+                return 0
+                ;;
+            *)
+                COMPREPLY=( $(compgen -W "ls list info create resize rm export import cp copy mv rename snap watch map unmap" -- ${cur}) )
+                return 0
+            ;;
+        esac
+}
+complete -F _rbd rbd
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] bash_completion: Add the bash_completion files to the Debian packages
  2011-06-28 18:28 [PATCH 0/3] Add BASH completion for various tools Wido den Hollander
  2011-06-28 18:28 ` [PATCH 1/3] bash_completion: Add bash completion for ceph, rados, radosgw_admin and rbd Wido den Hollander
@ 2011-06-28 18:28 ` Wido den Hollander
  2011-06-28 18:28 ` [PATCH 3/3] bash_completion: Add to the Makefile Wido den Hollander
  2 siblings, 0 replies; 4+ messages in thread
From: Wido den Hollander @ 2011-06-28 18:28 UTC (permalink / raw)
  To: ceph-devel; +Cc: Wido den Hollander


Signed-off-by: Wido den Hollander <wido@widodh.nl>
---
 debian/ceph-client-tools.install |    2 ++
 debian/ceph.install              |    1 +
 debian/radosgw.install           |    1 +
 3 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/debian/ceph-client-tools.install b/debian/ceph-client-tools.install
index 205eb7c..d9b3edd 100644
--- a/debian/ceph-client-tools.install
+++ b/debian/ceph-client-tools.install
@@ -6,3 +6,5 @@ usr/share/man/man8/csyn.8
 usr/share/man/man8/rados.8
 usr/share/man/man8/rbd.8
 usr/share/man/man8/mount.ceph.8
+etc/bash_completion.d/rados
+etc/bash_completion.d/rbd
diff --git a/debian/ceph.install b/debian/ceph.install
index b1160db..53de14f 100644
--- a/debian/ceph.install
+++ b/debian/ceph.install
@@ -30,3 +30,4 @@ usr/share/man/man8/cephfs.8
 usr/share/man/man8/cauthtool.8
 usr/share/man/man8/cclsinfo.8
 usr/share/man/man8/cdebugpack.8
+etc/bash_completion.d/ceph
diff --git a/debian/radosgw.install b/debian/radosgw.install
index 0a69f45..d968edd 100644
--- a/debian/radosgw.install
+++ b/debian/radosgw.install
@@ -2,3 +2,4 @@ usr/bin/radosgw
 usr/bin/radosgw_admin
 usr/share/man/man8/radosgw.8
 usr/share/man/man8/radosgw_admin.8
+etc/bash_completion.d/radosgw_admin
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] bash_completion: Add to the Makefile
  2011-06-28 18:28 [PATCH 0/3] Add BASH completion for various tools Wido den Hollander
  2011-06-28 18:28 ` [PATCH 1/3] bash_completion: Add bash completion for ceph, rados, radosgw_admin and rbd Wido den Hollander
  2011-06-28 18:28 ` [PATCH 2/3] bash_completion: Add the bash_completion files to the Debian packages Wido den Hollander
@ 2011-06-28 18:28 ` Wido den Hollander
  2 siblings, 0 replies; 4+ messages in thread
From: Wido den Hollander @ 2011-06-28 18:28 UTC (permalink / raw)
  To: ceph-devel; +Cc: Wido den Hollander


Signed-off-by: Wido den Hollander <wido@widodh.nl>
---
 src/Makefile.am |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index cffd09b..38bbf0e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -558,6 +558,12 @@ sample.fetch_config: fetch_config
 shell_commondir = $(libdir)/ceph
 shell_common_SCRIPTS = ceph_common.sh
 
+bash_completiondir = /etc/bash_completion.d
+bash_completion_DATA = $(srcdir)/bash_completion/ceph \
+		$(srcdir)/bash_completion/rados \
+		$(srcdir)/bash_completion/rbd \
+		$(srcdir)/bash_completion/radosgw_admin
+
 libceph_includedir = $(includedir)/ceph
 libceph_include_DATA = $(srcdir)/include/ceph/libceph.h
 
@@ -1149,7 +1155,11 @@ noinst_HEADERS = \
 	tools/gui_resources.h\
 	test/osd/RadosModel.h\
 	global/pidfile.h\
-	common/sync_filesystem.h
+	common/sync_filesystem.h\
+	bash_completion/ceph\
+	bash_completion/rados\
+	bash_completion/rbd\
+	bash_completion/radosgw_admin
 
 all_sources = $(cmon_SOURCES) $(ceph_SOURCES) $(cephfs_SOURCES) $(librados_config_SOURCES) $(cauthtool_SOURCES) $(monmaptool_SOURCES) \
 	$(crushtool_SOURCES) $(osdmaptool_SOURCES) $(cconf_SOURCES) $(mount_ceph_SOURCES) $(cmds_SOURCES) \
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-06-28 18:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-28 18:28 [PATCH 0/3] Add BASH completion for various tools Wido den Hollander
2011-06-28 18:28 ` [PATCH 1/3] bash_completion: Add bash completion for ceph, rados, radosgw_admin and rbd Wido den Hollander
2011-06-28 18:28 ` [PATCH 2/3] bash_completion: Add the bash_completion files to the Debian packages Wido den Hollander
2011-06-28 18:28 ` [PATCH 3/3] bash_completion: Add to the Makefile Wido den Hollander

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.