diff options
author | Mathieu Duponchelle <mathieu.duponchelle@opencreed.com> | 2015-02-26 13:19:25 +0100 |
---|---|---|
committer | Thibault Saunier <tsaunier@gnome.org> | 2015-03-23 12:41:00 +0100 |
commit | 8e18fd790c8711c0b8829d475d7cf12e7568d446 (patch) | |
tree | dd590602a0c9bd4d4b38b25b488dd972909cf251 /data | |
parent | d77ad923a6e3c4aa77856a778960d093a0f404d8 (diff) |
bash-completion: Add support for new ges-launch commands.
Diffstat (limited to 'data')
-rw-r--r-- | data/completions/ges-launch-1.0 | 97 |
1 files changed, 88 insertions, 9 deletions
diff --git a/data/completions/ges-launch-1.0 b/data/completions/ges-launch-1.0 index f8a126a3..e660a8a3 100644 --- a/data/completions/ges-launch-1.0 +++ b/data/completions/ges-launch-1.0 @@ -61,6 +61,58 @@ _ges___videosink () { COMPREPLY=( $(compgen -W "$($HELPER --klass=Sink --sinkcaps='video/x-raw')" -- $cur) ) } +_ges_clip () { + if [[ "$prev" == "$command" ]]; + then + _mandatory__argument + else + COMPREPLY=( $(compgen -W "duration= inpoint= start= layer= $(ges-launch-1.0 help all | egrep '^ [a-zA-Z0-9]')" -- $cur) ) + fi +} + +_ges_effect () { + if [[ "$prev" == "$command" ]]; + then + _mandatory__argument + else + COMPREPLY=( $(compgen -W "duration= start= layer= $(ges-launch-1.0 help all | egrep '^ [a-zA-Z0-9]')" -- $cur) ) + fi +} + +_ges_list_options () { + COMPREPLY=( $(compgen -W "$(ges-launch-1.0 --help-all | grep -oh '[[:graph:]]*--[[:graph:]]*' | cut -d'=' -f1)" -- $cur) ) +} + +_ges_list_commands () { + COMPREPLY=( $(compgen -W "$(ges-launch-1.0 help all | egrep '^ [a-zA-Z0-9]')" -- $cur) ) +} + +_ges_list_properties () { + local props + + if [[ "$real_command" == "" ]] + then + _mandatory__argument + elif [[ "$real_command" == "clip" ]] + then + COMPREPLY=( $(compgen -W "set-alpha set-posx set-posy set-width set-height set-volume set-mute" -- $cur) ) + elif [[ "$real_command" == "effect" ]] + then + COMPREPLY=() + effect_bin_description="${effect_bin_description//\"/ }" + array=(${effect_bin_description//!/ }) + for i in "${array[@]}"; do + props=("$($HELPER --element-properties $i)") + for j in $props; do + j="${j//=/ }" + COMPREPLY+=( $(compgen -W "set-$j" -- $cur) ) + done + done + else + _mandatory__argument + fi +} + _ges___exclude_ () { _mandatory__argument; } _ges___encoding_profile () { _mandatory__argument; } _ges___ges_sample_path () { _mandatory__argument; } @@ -69,9 +121,27 @@ _ges___thumbnail () { _mandatory__argument; } _ges___repeat () { _mandatory__argument; } _ges___save () { _mandatory__argument; } +containsElement () { + local e + for e in "${@:2}"; + do + [[ "$e" == "$1" ]] && return 0; + done + return 1 +} + __ges_main () { - local i=1 c=1 command function_exists completion_func + local i=1 c=1 command function_exists completion_func commands real_command effect_bin_description + + commands=($(ges-launch-1.0 help all | egrep '^ [a-zA-Z0-9]')) + real_command="" + effect_bin_description="" + + if [[ "$cur" == "=" ]]; then + _mandatory__argument + return + fi while [[ $i -ne $COMP_CWORD ]]; do @@ -80,15 +150,18 @@ __ges_main () if [[ "$var" == "--"* ]] then command="$var" + elif containsElement "$var" "${commands[@]}"; + then + real_command="$var" + command="$var" + if [[ "$var" == "effect" ]] + then + effect_bin_description="${COMP_WORDS[i+1]}" + fi fi i=$[$i+1] done - if [ -z "$command" ]; then - COMPREPLY=( $(compgen -W "$(ges-launch-1.0 --help-all | grep -oh '[[:graph:]]*--[[:graph:]]*' | cut -d'=' -f1)" -- $cur) ) - return - fi - if [[ "$command" == "--gst"* ]]; then completion_func="_${command//-/_}" else @@ -99,13 +172,19 @@ __ges_main () function_exists=$? - if [[ "$cur" == "--"* ]]; then - COMPREPLY=( $(compgen -W "$(ges-launch-1.0 --help-all | grep -oh '[[:graph:]]*--[[:graph:]]*' | cut -d'=' -f1)" -- $cur) ) + if [[ "$cur" == "-"* ]]; then + _ges_list_options + elif [[ "$cur" == "="* ]] + then + _mandatory__argument + elif [[ "$cur" == "set-"* ]] + then + _ges_list_properties elif [ $function_exists -eq 0 ] then $completion_func else - COMPREPLY=( $(compgen -W "$(ges-launch-1.0 --help-all | grep -oh '[[:graph:]]*--[[:graph:]]*' | cut -d'=' -f1)" -- $cur) ) + _ges_list_commands fi } |