tools/gstreamer-completion: Replacement for gst-complete written in sh and sed. ...
authorDavid Schleef <ds@schleef.org>
Sun, 25 Dec 2005 03:45:45 +0000 (03:45 +0000)
committerDavid Schleef <ds@schleef.org>
Sun, 25 Dec 2005 03:45:45 +0000 (03:45 +0000)
Original commit message from CVS:
* tools/gstreamer-completion:
Replacement for gst-complete written in sh and sed.  Only
completes names of features, but that's 90% of what I want
it for.  Properties are not available in registry.xml.  (Maybe
they should be...)

ChangeLog
tools/gstreamer-completion [new file with mode: 0644]

index 264eced..2390e54 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2005-12-24  David Schleef  <ds@schleef.org>
+
+       * tools/gstreamer-completion:
+         Replacement for gst-complete written in sh and sed.  Only
+         completes names of features, but that's 90% of what I want
+         it for.  Properties are not available in registry.xml.  (Maybe
+         they should be...)
+
 === release 0.10.1 ===
 
 2005-12-23  Thomas Vander Stichele <thomas at apestaart dot org>
diff --git a/tools/gstreamer-completion b/tools/gstreamer-completion
new file mode 100644 (file)
index 0000000..8770bd4
--- /dev/null
@@ -0,0 +1,27 @@
+#
+# Put this in /etc/bash_completion.d/
+#
+
+_gst_launch()
+{
+  local cur
+
+  : ${GST_REGISTRY:=~/.gstreamer-0.10/registry.xml}
+  : ${GST_COMPLETE:=~/.gstreamer-0.10/complete}
+
+  if [ ! -f "${GST_REGISTRY}" ] ; then
+    return 0
+  fi
+
+  if [ ! -f "${GST_COMPLETE}" \
+       -o "${GST_REGISTRY}" -nt "${GST_COMPLETE}" ] ; then
+    sed -n 's/^..<name>\(.*\)<\/name>/\1/ p' ${GST_REGISTRY} >${GST_COMPLETE}
+  fi
+
+  cur=${COMP_WORDS[COMP_CWORD]}
+  COMPREPLY=( $(grep ^$cur $GST_COMPLETE) )
+
+  return 0
+}
+complete -F _gst_launch -o default gst-launch
+