[tracker/tracker-cmd: 9/12] tracker: Added bash completion



commit f61fd30831d92bbcdf211a92d55015f825333afd
Author: Martyn Russell <martyn lanedo com>
Date:   Mon Oct 6 11:35:07 2014 +0100

    tracker: Added bash completion

 src/tracker/Makefile.am       |    6 ++++++
 src/tracker/tracker-prompt.sh |   10 ++++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/tracker/Makefile.am b/src/tracker/Makefile.am
index 5652f01..fff4bb1 100644
--- a/src/tracker/Makefile.am
+++ b/src/tracker/Makefile.am
@@ -54,3 +54,9 @@ tracker_LDADD = \
        $(top_builddir)/src/libtracker-common/libtracker-common.la \
        $(BUILD_LIBS) \
        $(TRACKER_LIBS)
+
+# Bash completion
+completiondir = $(sysconfdir)/bash_completion.d
+completion_DATA = tracker-prompt.sh
+
+EXTRA_DIST = $(completion_DATA)
diff --git a/src/tracker/tracker-prompt.sh b/src/tracker/tracker-prompt.sh
new file mode 100644
index 0000000..8022b6a
--- /dev/null
+++ b/src/tracker/tracker-prompt.sh
@@ -0,0 +1,10 @@
+#-*- mode: shell-script;-*-
+
+tracker_cmds()
+{
+    possible=`tracker | egrep "   [a-z].*   " | awk '{ print ($1) }'`
+    local cur=${COMP_WORDS[COMP_CWORD]}
+    COMPREPLY=( $(compgen -W "$possible" -- $cur) )
+}
+
+complete -F tracker_cmds tracker


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]