]>
Commit | Line | Data |
---|---|---|
3d298606 | 1 | __youtube_dl() |
cc51a7d4 | 2 | { |
5f09bbff | 3 | local cur prev opts fileopts diropts keywords |
cc51a7d4 FV |
4 | COMPREPLY=() |
5 | cur="${COMP_WORDS[COMP_CWORD]}" | |
c1f9c59d | 6 | prev="${COMP_WORDS[COMP_CWORD-1]}" |
bdff3455 | 7 | opts="{{flags}}" |
5f09bbff | 8 | keywords=":ytfavorites :ytrecommended :ytsubscriptions :ytwatchlater :ythistory" |
1c0f31f9 | 9 | fileopts="-a|--batch-file|--download-archive|--cookies|--load-info" |
c1f9c59d JMF |
10 | diropts="--cache-dir" |
11 | ||
12 | if [[ ${prev} =~ ${fileopts} ]]; then | |
13 | COMPREPLY=( $(compgen -f -- ${cur}) ) | |
14 | return 0 | |
15 | elif [[ ${prev} =~ ${diropts} ]]; then | |
16 | COMPREPLY=( $(compgen -d -- ${cur}) ) | |
17 | return 0 | |
18 | fi | |
cc51a7d4 | 19 | |
9193c1ee JMF |
20 | if [[ ${cur} =~ : ]]; then |
21 | COMPREPLY=( $(compgen -W "${keywords}" -- ${cur}) ) | |
22 | return 0 | |
23 | elif [[ ${cur} == * ]] ; then | |
cc51a7d4 FV |
24 | COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) |
25 | return 0 | |
26 | fi | |
27 | } | |
28 | ||
3d298606 | 29 | complete -F __youtube_dl youtube-dl |