1# GStreamer 2# Copyright (C) 2015 Mathieu Duponchelle <mathieu.duponchelle@opencreed.com> 3# 4# bash/zsh completion support for common gstreamer options 5# 6# This library is free software; you can redistribute it and/or 7# modify it under the terms of the GNU Library General Public 8# License as published by the Free Software Foundation; either 9# version 2 of the License, or (at your option) any later version. 10# 11# This library is distributed in the hope that it will be useful, 12# but WITHOUT ANY WARRANTY; without even the implied warranty of 13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14# Library General Public License for more details. 15# 16# You should have received a copy of the GNU Library General Public 17# License along with this library; if not, write to the 18# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, 19# Boston, MA 02110-1301, USA. 20 21_GST_HELPER="@GST_COMPLETION_HELPER_INSTALLED@" 22if [[ ! -x "$_GST_HELPER" ]] 23then 24 helper="$(pkg-config --variable=helpersdir gstreamer-@GST_API_VERSION@)/gst-completion-helper" 25 26 if [ -x "$helper" ] 27 then 28 _GST_HELPER=$helper 29 fi 30fi 31 32___gst_debug_level () { _gst_mandatory_argument; } 33___gst_debug () { _gst_mandatory_argument; } 34___gst_debug_color_mode () { _gst_mandatory_argument; } 35___gst_plugin_path () { _gst_mandatory_argument; } 36___gst_plugin_load () { _gst_mandatory_argument; } 37 38_gst_all_arguments () 39{ 40 COMPREPLY=( $(compgen -W "$($1 --help-all | grep "^ -" | grep -oh '[[:graph:]]*--[[:graph:]]*\|-[[:alpha:]],' | cut -d'=' -f1 | cut -d',' -f1)" -- $cur) ) 41} 42 43_gst_mandatory_argument () 44{ 45 __app=$1 46 if [[ -z $__app ]] 47 then 48 __app=gst-launch-1.0 49 fi 50 51 if [[ "$prev" != "$command" ]] 52 then 53 _gst_all_arguments $__app 54 else 55 COMPREPLY=("$cur") 56 fi 57} 58