Portál AbcLinuxu, 12. listopadu 2025 14:31
"\t": menu-completedo inputrc. A vůbec dokumentace k bashi je poměrně šikovná věc (i když poněkud obsáhlá).
# programmable bash_completion file for mplayer application
_to_play() {
local prev cur options IFS=$'\t\n'
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
case $prev in
-vo)
COMPREPLY=( $(
mplayer -vo help|grep -P '\t(\w)'|cut -f2
) )
;;
-ao)
COMPREPLY=( $(
mplayer -ao help|grep -P '\t(\w)'|cut -f2
) )
;;
*)
COMPREPLY=( $(
compgen -G "${cur}*" -X '!*.mp3'
compgen -G "${cur}*" -X '!*.avi'
compgen -G "${cur}*" -X '!*.wav'
compgen -G "${cur}*" -X '!*.mov'
) )
;;
esac
return 0
}
complete -d -X '.[^./]*' -F _to_play -o filenames -o dirnames mplayer
Ja som si spravil toto pre mplayer. Zapisane je to v /etc/bash_complete.d/mplayer.sh a doplnuje mi to subory, ktore vie mplayer prehrat a pre -vo a -ao dostupne devices.
#okamzite doplneni po tabu # set show-all-if-ambiguous on If you have this in your /etc/inputrc or ~/.inputrc, you will no longer have to hit the <Tab> key twice to produce a list of all possible completions. A single <Tab> will suffice. This setting is highly recommended.Možná myslíte tohle...
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.