-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlivestreamer.bash
More file actions
44 lines (36 loc) · 1.03 KB
/
livestreamer.bash
File metadata and controls
44 lines (36 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# livestreamer.bash
# =================
#
# Bash completion support for Livestreamer (http://livestreamer.tanuki.se/)
#
# See README.md for install instructions.
#
# Will complete URLs from these files if they exist.
URL_SOURCES=$(ls ~/.config/livestreamer/favorites* 2>/dev/null)
_livestreamer_help_cache=""
_livestreamer()
{
local cur prev words cword
_init_completion || return
case $prev in
-h|--help|-V|--version|--plugins)
return
;;
esac
if [[ $cur == -* ]]; then
if [[ $_livestreamer_help_cache == "" ]]; then
_livestreamer_help_cache=$(_parse_help $1)
fi
COMPREPLY=($(compgen -W "$_livestreamer_help_cache" -- "$cur"))
return
fi
local valid_sources=""
for wordlist in $URL_SOURCES; do
if [[ -f $wordlist ]]; then
valid_sources="$valid_sources $wordlist"
fi
done
COMPREPLY=($(compgen -W '$(cat $valid_sources)' -- "$cur"))
} &&
complete -F _livestreamer livestreamer
# ex: ts=4 sw=4 et filetype=sh