diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 01:03:19 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 01:03:19 +0000 |
commit | 6c09f2a45c5541e9c207d14fc7aa21a4a0066bde (patch) | |
tree | 0221189d367bf661f6f9493c4f17a03f0dd4b7d2 /completions/mplayer | |
parent | Releasing progress-linux version 1:2.11-8~progress7.99u1. (diff) | |
download | bash-completion-6c09f2a45c5541e9c207d14fc7aa21a4a0066bde.tar.xz bash-completion-6c09f2a45c5541e9c207d14fc7aa21a4a0066bde.zip |
Merging upstream version 1:2.12.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | completions/mplayer | 203 |
1 files changed, 99 insertions, 104 deletions
diff --git a/completions/mplayer b/completions/mplayer index d71ebb8..7ab096a 100644 --- a/completions/mplayer +++ b/completions/mplayer @@ -1,120 +1,120 @@ # mplayer(1) completion -*- shell-script -*- -_mplayer_options_list() +_comp_cmd_mplayer__options() { cur=${cur%\\} - COMPREPLY=($(compgen -W "$($1 -noconfig all $2 help 2>/dev/null | - command sed -e '/^Available/,/^$/!d' -e '/^Available/d' | awk '{print $1}' | - command sed -e 's/:$//' -e 's/^'${2#-}'$//' -e 's/<.*//')" -- "$cur")) + _comp_compgen_split -- "$("$1" -noconfig all "$2" help 2>/dev/null | + command sed -e '/^Available/,/^$/!d' -e '/^Available/d' | _comp_awk '{print $1}' | + command sed -e 's/:$//' -e 's/^'"${2#-}"'$//' -e 's/<.*//')" } -_mplayer() +_comp_cmd_mplayer() { - local cur prev words cword - _init_completion -n : || return + local cur prev words cword comp_args + _comp_initialize -n : -- "$@" || return local cmd=${words[0]} i j k=0 case $prev in -[av][cfo] | -[av]fm | -vop | -fstype | -demuxer | -o[av]c | -of | -profile | \ -audio-demuxer | -sub-demuxer) - _mplayer_options_list $cmd $prev + _comp_cmd_mplayer__options "$cmd" "$prev" return ;; -show-profile) - _mplayer_options_list $cmd -profile + _comp_cmd_mplayer__options "$cmd" -profile return ;; -audiofile | -audio-file) - _filedir '@(mp3|mpg|og[ag]|w?(a)v|mid|flac|mka|ac3|ape)' + _comp_compgen_filedir '@(mp3|mpg|og[ag]|w?(a)v|mid|flac|mka|ac3|ape)' return ;; -font | -subfont) if [[ $prev == -font ]]; then - _filedir '@(desc|ttf)' + _comp_compgen_filedir '@(desc|ttf)' else - _filedir ttf + _comp_compgen_filedir ttf fi - local IFS=$'\n' - COMPREPLY+=($(compgen -W '$(fc-list 2>/dev/null)' -- "$cur")) + _comp_compgen -a split -l -- "$(fc-list 2>/dev/null)" return ;; -sub | -sub-file) - _filedir '@(srt|sub|txt|utf|rar|mpsub|smi|js|ssa|ass)' + _comp_compgen_filedir '@(srt|sub|txt|utf|rar|mpsub|smi|js|ssa|ass)' return ;; -vobsub) - _filedir '@(idx|ifo|sub)' - local IFS=$'\n' - COMPREPLY=($(for i in "${COMPREPLY[@]}"; do - if [[ -f $i && -r $i ]]; then - printf '%s\n' ${i%.*} - else - printf '%s\n' $i - fi - done)) + if _comp_compgen_filedir '@(idx|ifo|sub)'; then + for i in "${!COMPREPLY[@]}"; do + if [[ -f ${COMPREPLY[i]} && -r ${COMPREPLY[i]} ]]; then + COMPREPLY[i]=${COMPREPLY[i]%.*} + fi + done + fi return ;; -subcp | -msgcharset) local cp - cp=($(iconv --list 2>/dev/null | command sed -e "s@//@@;" 2>/dev/null)) - if [[ $cur == "${cur,,}" ]]; then - COMPREPLY=($(compgen -W '${cp[@],,}' -- "$cur")) - else - COMPREPLY=($(compgen -W '${cp[@]^^}' -- "$cur")) + if _comp_split cp "$(iconv --list 2>/dev/null | command sed -e "s@//@@;" 2>/dev/null)"; then + if [[ $cur == "${cur,,}" ]]; then + _comp_compgen -- -W '"${cp[@],,}"' + else + _comp_compgen -- -W '"${cp[@]^^}"' + fi fi return ;; -ifo) - _filedir ifo + _comp_compgen_filedir ifo return ;; -cuefile) - _filedir '@(bin|cue)' + _comp_compgen_filedir '@(bin|cue)' return ;; -skin) # if you don't have installed mplayer in /usr you # may want to set the MPLAYER_SKINS_DIR global variable local -a dirs - if [[ -n $MPLAYER_SKINS_DIR ]]; then - dirs=($MPLAYER_SKINS_DIR) + if [[ $MPLAYER_SKINS_DIR ]]; then + _comp_split dirs "$MPLAYER_SKINS_DIR" else dirs=(/usr/share/mplayer/skins /usr/local/share/mplayer/skins) fi - local IFS=$'\n' - for i in ~/.mplayer/skins "${dirs[@]}"; do - if [[ -d $i && -r $i ]]; then - for j in $(compgen -d -- $i/$cur); do - COMPREPLY[k++]=${j#$i/} - done - fi - done + if ((${#dirs[@]})); then + local -a subdirs + for i in ~/.mplayer/skins "${dirs[@]}"; do + if [[ -d $i && -r $i ]]; then + _comp_compgen -v subdirs -c "$i/$cur" -- -d + for j in "${subdirs[@]}"; do + COMPREPLY[k++]=${j#"$i/"} + done + fi + done + fi return ;; -cdrom-device) - _cd_devices - _dvd_devices + _comp_compgen_cd_devices + _comp_compgen -a dvd_devices return ;; -dvd-device) - _dvd_devices - _filedir iso + _comp_compgen_dvd_devices + _comp_compgen -a filedir iso return ;; -bluray-device) - _filedir -d + _comp_compgen_filedir -d return ;; -mixer | -dvdauth | -fb | -zrdev) - cur=${cur:=/dev/} - _filedir + _comp_compgen -c "${cur:-/dev/}" filedir return ;; -edl | -edlout | -lircconf | -menu-cfg | -playlist | -csslib | -dumpfile | \ -subfile | -aofile | -fbmodeconfig | -include | -o | -dvdkey | -passlogfile) - _filedir + _comp_compgen_filedir return ;; -autoq | -autosync | -loop | -menu-root | -speed | -sstep | -aid | -alang | \ @@ -136,124 +136,119 @@ _mplayer() return ;; -channels) - COMPREPLY=($(compgen -W '2 4 6 8' -- "$cur")) + _comp_compgen -- -W '2 4 6 8' return ;; -aspect | -monitoraspect) - COMPREPLY=($(compgen -W '1:1 3:2 4:3 5:4 14:9 14:10 16:9 16:10 - 2.35:1' -- "$cur")) - __ltrim_colon_completions "$cur" + _comp_compgen -- -W '1:1 3:2 4:3 5:4 14:9 14:10 16:9 16:10 2.35:1' + _comp_ltrim_colon_completions "$cur" return ;; -lavdopts) - COMPREPLY=($(compgen -W 'bitexact bug= debug= ec= er= fast gray - idct= lowres= sb= st= skiploopfilter= skipidct= skipframe= - threads= vismv= vstats' -- "$cur")) + _comp_compgen -- -W 'bitexact bug= debug= ec= er= fast gray idct= + lowres= sb= st= skiploopfilter= skipidct= skipframe= threads= + vismv= vstats' return ;; -lavcopts) - COMPREPLY=($(compgen -W 'vcodec= vqmin= vqscale= vqmax= mbqmin= - mbqmax= vqdiff= vmax_b_frames= vme= vhq v4mv keyint= - vb_strategy= vpass= aspect= vbitrate= vratetol= vrc_maxrate= - vrc_minrate= vrc_buf_size= vb_qfactor= vi_qfactor= vb_qoffset= - vi_qoffset= vqblur= vqcomp= vrc_eq= vrc_override= - vrc_init_cplx= vqsquish= vlelim= vcelim= vstrict= vdpart - vpsize= gray vfdct= idct= lumi_mask= dark_mask= tcplx_mask= - scplx_mask= naq ildct format= pred qpel precmp= cmp= subcmp= - predia= dia= trell last_pred= preme= subq= psnr mpeg_quant aic - umv' -- "$cur")) + _comp_compgen -- -W 'vcodec= vqmin= vqscale= vqmax= mbqmin= mbqmax= + vqdiff= vmax_b_frames= vme= vhq v4mv keyint= vb_strategy= + vpass= aspect= vbitrate= vratetol= vrc_maxrate= vrc_minrate= + vrc_buf_size= vb_qfactor= vi_qfactor= vb_qoffset= vi_qoffset= + vqblur= vqcomp= vrc_eq= vrc_override= vrc_init_cplx= vqsquish= + vlelim= vcelim= vstrict= vdpart vpsize= gray vfdct= idct= + lumi_mask= dark_mask= tcplx_mask= scplx_mask= naq ildct format= + pred qpel precmp= cmp= subcmp= predia= dia= trell last_pred= + preme= subq= psnr mpeg_quant aic umv' return ;; -ssf) - COMPREPLY=($(compgen -W 'lgb= cgb= ls= cs= chs= cvs=' -- "$cur")) + _comp_compgen -- -W 'lgb= cgb= ls= cs= chs= cvs=' return ;; -jpeg) - COMPREPLY=($(compgen -W 'noprogressive progressive nobaseline - baseline optimize= smooth= quality= outdir=' -- "$cur")) + _comp_compgen -- -W 'noprogressive progressive nobaseline baseline + optimize= smooth= quality= outdir=' return ;; -xvidopts) - COMPREPLY=($(compgen -W 'dr2 nodr2' -- "$cur")) + _comp_compgen -- -W 'dr2 nodr2' return ;; -xvidencopts) - COMPREPLY=($(compgen -W 'pass= bitrate= fixed_quant= me_quality= - 4mv rc_reaction_delay_factor= rc_averaging_period= rc_buffer= + _comp_compgen -- -W 'pass= bitrate= fixed_quant= me_quality= 4mv + rc_reaction_delay_factor= rc_averaging_period= rc_buffer= quant_range= min_key_interval= max_key_interval= mpeg_quant mod_quant lumi_mask hintedme hintfile debug keyframe_boost= - kfthreshold= kfreduction=' -- "$cur")) + kfthreshold= kfreduction=' return ;; -divx4opts) - COMPREPLY=($(compgen -W 'br= key= deinterlace q= min_quant= - max_quant= rc_period= rc_reaction_period= crispness= - rc_reaction_ratio= pass= vbrpass= help' -- "$cur")) + _comp_compgen -- -W 'br= key= deinterlace q= min_quant= max_quant= + rc_period= rc_reaction_period= crispness= rc_reaction_ratio= + pass= vbrpass= help' return ;; -info) - COMPREPLY=($(compgen -W 'name= artist= genre= subject= - copyright= srcform= comment= help' -- "$cur")) + _comp_compgen -- -W 'name= artist= genre= subject= copyright= + srcform= comment= help' return ;; -lameopts) - COMPREPLY=($(compgen -W 'vbr= abr cbr br= q= aq= ratio= vol= - mode= padding= fast preset= help' -- "$cur")) + _comp_compgen -- -W 'vbr= abr cbr br= q= aq= ratio= vol= mode= + padding= fast preset= help' return ;; -rawaudio) - COMPREPLY=($(compgen -W 'on channels= rate= samplesize= format=' \ - -- "$cur")) + _comp_compgen -- -W 'on channels= rate= samplesize= format=' return ;; -rawvideo) - COMPREPLY=($(compgen -W 'on fps= sqcif qcif cif 4cif pal ntsc w= - h= y420 yv12 yuy2 y8 format= size=' -- "$cur")) + _comp_compgen -- -W 'on fps= sqcif qcif cif 4cif pal ntsc w= h= + y420 yv12 yuy2 y8 format= size=' return ;; -aop) - COMPREPLY=($(compgen -W 'list= delay= format= fout= volume= mul= - softclip' -- "$cur")) + _comp_compgen -- -W 'list= delay= format= fout= volume= mul= + softclip' return ;; -dxr2) - COMPREPLY=($(compgen -W 'ar-mode= iec958-encoded iec958-decoded - mute ucode= 75ire bw color interlaced macrovision= norm= + _comp_compgen -- -W 'ar-mode= iec958-encoded iec958-decoded mute + ucode= 75ire bw color interlaced macrovision= norm= square-pixel ccir601-pixel cr-left= cr-right= cr-top= cr-bot= ck-rmin= ck-gmin= ck-bmin= ck-rmax= ck-gmax= ck-bmax= ck-r= ck-g= ck-b= ignore-cache= ol-osd= olh-cor= olw-cor= olx-cor= - oly-cor= overlay overlay-ratio= update-cache' -- "$cur")) + oly-cor= overlay overlay-ratio= update-cache' return ;; -tv) - COMPREPLY=($(compgen -W 'on noaudio driver= device= input= freq= + _comp_compgen -- -W 'on noaudio driver= device= input= freq= outfmt= width= height= buffersize= norm= channel= chanlist= audiorate= forceaudio alsa amode= forcechan= adevice= audioid= - volume= bass= treble= balance= fps= channels= immediatemode=' \ - -- "$cur")) + volume= bass= treble= balance= fps= channels= immediatemode=' return ;; -mf) - COMPREPLY=($(compgen -W 'on w= h= fps= type=' -- "$cur")) + _comp_compgen -- -W 'on w= h= fps= type=' return ;; -cdda) - COMPREPLY=($(compgen -W 'speed= paranoia= generic-dev= - sector-size= overlap= toc-bias toc-offset= skip noskip' \ - -- "$cur")) + _comp_compgen -- -W 'speed= paranoia= generic-dev= sector-size= + overlap= toc-bias toc-offset= skip noskip' return ;; -input) - COMPREPLY=($(compgen -W 'conf= ar-delay ar-rate keylist cmdlist - js-dev file' -- "$cur")) + _comp_compgen -- -W 'conf= ar-delay ar-rate keylist cmdlist js-dev + file' return ;; -af-adv) - COMPREPLY=($(compgen -W 'force= list=' -- "$cur")) + _comp_compgen -- -W 'force= list=' return ;; -noconfig) - COMPREPLY=($(compgen -W 'all gui system user' -- "$cur")) + _comp_compgen -- -W 'all gui system user' return ;; -*) @@ -271,17 +266,17 @@ _mplayer() case $cur in -*) - COMPREPLY=($(compgen -W '$($cmd -noconfig all -list-options 2>/dev/null | \ + _comp_compgen_split -- "$("$cmd" -noconfig all -list-options 2>/dev/null | command sed -ne "1,/^[[:space:]]*Name/d" \ -e "s/^[[:space:]]*/-/" -e "s/[[:space:]:].*//" \ - -e "/^-\(Total\|.*\*\)\{0,1\}$/!p")' -- "$cur")) + -e "/^-\(Total\|.*\*\)\{0,1\}$/!p")" ;; *) - _filedir '@(m?(j)p?(e)g|M?(J)P?(E)G|wm[av]|WM[AV]|avi|AVI|asf|ASF|vob|VOB|bin|BIN|dat|DAT|vcd|VCD|ps|PS|pes|PES|fl[iv]|FL[IV]|fxm|FXM|viv|VIV|rm?(j)|RM?(J)|ra?(m)|RA?(M)|yuv|YUV|mov|MOV|qt|QT|mp[234]|MP[234]|m?(p)4[av]|M?(P)4[AV]|og[gmavx]|OG[GMAVX]|w?(a)v|W?(A)V|dump|DUMP|mk[av]|MK[AV]|aac|AAC|m2v|M2V|dv|DV|rmvb|RMVB|mid|MID|t[ps]|T[PS]|3g[p2]|3gpp?(2)|mpc|MPC|flac|FLAC|vro|VRO|divx|DIVX|aif?(f)|AIF?(F)|m2t?(s)|M2T?(S)|mts|MTS|vdr|VDR|xvid|XVID|ape|APE|gif|GIF|nut|NUT|bik|BIK|web[am]|WEB[AM]|amr|AMR|awb|AWB|iso|ISO|opus|OPUS|m[eo]d|M[EO]D|xm|XM|it|IT|s[t3]m|S[T3]M|mtm|MTM|w64|W64)?(.@(crdownload|part))' + _comp_compgen_filedir '@(m?(j)p?(e)g|M?(J)P?(E)G|wm[av]|WM[AV]|avi|AVI|asf|ASF|vob|VOB|bin|BIN|dat|DAT|vcd|VCD|ps|PS|pes|PES|fl[iv]|FL[IV]|fxm|FXM|viv|VIV|rm?(j)|RM?(J)|ra?(m)|RA?(M)|yuv|YUV|mov|MOV|qt|QT|mp[234]|MP[234]|m?(p)4[av]|M?(P)4[AV]|og[gmavx]|OG[GMAVX]|w?(a)v|W?(A)V|dump|DUMP|mk[av]|MK[AV]|aac|AAC|m2v|M2V|dv|DV|rmvb|RMVB|mid|MID|t[ps]|T[PS]|3g[p2]|3gpp?(2)|mpc|MPC|flac|FLAC|vro|VRO|divx|DIVX|aif?(f)|AIF?(F)|m2t?(s)|M2T?(S)|mts|MTS|vdr|VDR|xvid|XVID|ape|APE|gif|GIF|nut|NUT|bik|BIK|web[am]|WEB[AM]|amr|AMR|awb|AWB|iso|ISO|opus|OPUS|m[eo]d|M[EO]D|xm|XM|it|IT|s[t3]m|S[T3]M|mtm|MTM|w64|W64)?(.@(crdownload|part))' ;; esac } && - complete -F _mplayer mplayer mplayer2 mencoder gmplayer kplayer + complete -F _comp_cmd_mplayer mplayer mplayer2 mencoder gmplayer kplayer # ex: filetype=sh |