summaryrefslogtreecommitdiff
path: root/tools/gstreamer-completion
blob: d85e49c11befbe00678aa60ad9f55a64750ac37a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#
# Put this in /etc/bash_completion.d/
#

_gst_launch()
{
  local cur

  : ${GST_REGISTRY:=~/.gstreamer-0.11/registry.xml}
  : ${GST_COMPLETE:=~/.gstreamer-0.11/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