gstreamer/data/bash-completion/helpers/gst.in
Nicolas Dufresne bae1fe254a completion: Place the completion helper in libexec
This patch reorganize the bash completion scripts in order to install
the binary helper (gst-completion-helper) in libexec path rather then
share folder. Most Linux hierarchy compliance requires that no binary
executable are placed in share. We also cleanup the unused .pc entries
and remove copy pasted parts of the script. Note that other project
including the common helper, should now use $_GST_HELPER to read
the binary executable gst-completion-helper. This helper is not longer
version, as it is placed in a versionned subfolder
(libexec/gstreamer.10) just like the other helpers (scanner and ptp).
2017-04-04 14:46:48 -04:00

58 lines
1.7 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# GStreamer
# Copyright (C) 2015 Mathieu Duponchelle <mathieu.duponchelle@opencreed.com>
#
# bash/zsh completion support for common gstreamer options
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301, USA.
_GST_HELPER="@GST_COMPLETION_HELPER_INSTALLED@"
if [[ ! -x "$_GST_HELPER" ]]
then
helper="$(pkg-config --variable=helpersdir gstreamer-@GST_API_VERSION@)/gst-completion-helper"
if [ -x "$helper" ]
then
_GST_HELPER=$helper
fi
fi
___gst_debug_level () { _gst_mandatory_argument; }
___gst_debug () { _gst_mandatory_argument; }
___gst_debug_color_mode () { _gst_mandatory_argument; }
___gst_plugin_path () { _gst_mandatory_argument; }
___gst_plugin_load () { _gst_mandatory_argument; }
_gst_all_arguments ()
{
COMPREPLY=( $(compgen -W "$($1 --help-all | grep -oh '[[:graph:]]*--[[:graph:]]*\|-[[:alpha:]],' | cut -d'=' -f1 | cut -d',' -f1)" -- $cur) )
}
_gst_mandatory_argument ()
{
__app=$1
if [[ -z $__app ]]
then
__app=gst-launch-1.0
fi
if [[ "$prev" != "$command" ]]
then
_gst_all_arguments $__app
else
COMPREPLY=("$cur")
fi
}