diff options
author | Mathieu Duponchelle <mathieu.duponchelle@opencreed.com> | 2015-03-18 14:37:11 +0100 |
---|---|---|
committer | Mathieu Duponchelle <mathieu.duponchelle@opencreed.com> | 2015-03-24 19:11:31 +0100 |
commit | c72abb27377feec378f4712241e93a445a93ed2a (patch) | |
tree | 5c95c7a5c0ec009a9dae6bc052d738b82e1a9be2 | |
parent | 038c0a136053dc89f162b38f003e9ededdb88281 (diff) |
completions: prefix shell functions with _gst
+ To make it more difficult for them to conflict in the
global namespace.
https://bugzilla.gnome.org/show_bug.cgi?id=744877#c21
-rw-r--r-- | data/completions/gst-inspect-1.0 | 18 | ||||
-rw-r--r-- | data/completions/gst-launch-1.0 | 26 |
2 files changed, 22 insertions, 22 deletions
diff --git a/data/completions/gst-inspect-1.0 b/data/completions/gst-inspect-1.0 index 130b96308..ebb4d6273 100644 --- a/data/completions/gst-inspect-1.0 +++ b/data/completions/gst-inspect-1.0 @@ -31,12 +31,12 @@ fi HELPER="$HELPERDIR/gst-completion-helper-1.0" -_inspect_all_arguments () +_gst_inspect_all_arguments () { COMPREPLY=( $(compgen -W "$(gst-inspect-1.0 --help-all | grep -oh '[[:graph:]]*--[[:graph:]]*' | cut -d'=' -f1)" -- $cur) ) } -_inspect_all_elements () +_gst_inspect_all_elements () { COMPREPLY=( $(compgen -W "$($HELPER -l)" -- $cur) ) } @@ -45,7 +45,7 @@ _gstinspect___atleast_version () { _mandatory__argument; } _gstinspect___exists () { - _inspect_all_elements + _gst_inspect_all_elements } __inspect_main () @@ -74,16 +74,16 @@ __inspect_main () function_exists=$? if [[ "$cur" == "--"* ]]; then - _inspect_all_arguments + _gst_inspect_all_arguments elif [ $function_exists -eq 0 ] then $completion_func else - _inspect_all_elements + _gst_inspect_all_elements fi } -__inspect_func_wrap () +_gst_inspect_func_wrap () { local cur prev cur="${COMP_WORDS[COMP_CWORD]}" @@ -94,12 +94,12 @@ __inspect_func_wrap () # Setup completion for certain functions defined above by setting common # variables and workarounds. # This is NOT a public function; use at your own risk. -__inspect_complete () +_gst_inspect_complete () { local wrapper="__inspect_wrap${2}" - eval "$wrapper () { __inspect_func_wrap $2 ; }" + eval "$wrapper () { _gst_inspect_func_wrap $2 ; }" complete -o bashdefault -o default -o nospace -F $wrapper $1 2>/dev/null \ || complete -o default -o nospace -F $wrapper $1 } -__inspect_complete gst-inspect-1.0 __inspect_main +_gst_inspect_complete gst-inspect-1.0 __inspect_main diff --git a/data/completions/gst-launch-1.0 b/data/completions/gst-launch-1.0 index a12e06efd..d481076ee 100644 --- a/data/completions/gst-launch-1.0 +++ b/data/completions/gst-launch-1.0 @@ -31,29 +31,29 @@ fi HELPER="$HELPERDIR/gst-completion-helper-1.0" -_launch_all_arguments () +_gst_launch_all_arguments () { COMPREPLY=( $(compgen -W "$(gst-launch-1.0 --help-all | grep -oh '[[:graph:]]*--[[:graph:]]*' | cut -d'=' -f1)" -- $cur) ) } -_complete_compatible_elements () +_gst_complete_compatible_elements () { COMPREPLY=( $(compgen -W "$($HELPER --compatible-with $previous_element)" -- $cur) ) } -_complete_all_elements () +_gst_complete_all_elements () { COMPREPLY=( $(compgen -W "$($HELPER -l)" -- $cur) ) } -_complete_element_properties () +_gst_complete_element_properties () { COMPREPLY=( $(compgen -W "$($HELPER --element-properties $previous_element)" -- $cur) ) } _gstlaunch___exclude_ () { _mandatory__argument; } -__launch_main () +_gst_launch_main () { local i=1 command function_exists previous_element have_previous_element=0 completion_func @@ -106,22 +106,22 @@ __launch_main () function_exists=$? if [[ "$cur" == "--"* ]]; then - _launch_all_arguments + _gst_launch_all_arguments elif [ $function_exists -eq 0 ] then $completion_func elif [ $have_previous_element -ne 0 ] && [[ "$prev" == "!" ]] then - _complete_compatible_elements + _gst_complete_compatible_elements elif [ $have_previous_element -ne 0 ] then - _complete_element_properties + _gst_complete_element_properties else - _complete_all_elements + _gst_complete_all_elements fi } -__launch_func_wrap () +_gst_launch_func_wrap () { local cur prev cur="${COMP_WORDS[COMP_CWORD]}" @@ -132,12 +132,12 @@ __launch_func_wrap () # Setup completion for certain functions defined above by setting common # variables and workarounds. # This is NOT a public function; use at your own risk. -__launch_complete () +_gst_launch_complete () { local wrapper="__launch_wrap${2}" - eval "$wrapper () { __launch_func_wrap $2 ; }" + eval "$wrapper () { _gst_launch_func_wrap $2 ; }" complete -o bashdefault -o default -o nospace -F $wrapper $1 2>/dev/null \ || complete -o default -o nospace -F $wrapper $1 } -__launch_complete gst-launch-1.0 __launch_main +_gst_launch_complete gst-launch-1.0 _gst_launch_main |