nix

configuration files that power my machines
Log | Files | Refs | README | LICENSE

twitch (452B)


      1 #!/bin/zsh
      2 
      3 TWITCH_CHANNELS_FILE="$HOME/.config/twitch/channels"
      4 
      5 tww() {
      6 	local channel="${1?Usage: tww <channel>}"
      7 	mpv "https://twitch.tv/$channel" --no-terminal --no-resume-playback &
      8 	disown
      9 }
     10 
     11 _twitch_completion() {
     12 	local -a channels
     13 	if [[ -f "$TWITCH_CHANNELS_FILE" ]]; then
     14 		while IFS= read -r line; do
     15 			channels+=("${line%% *}")
     16 		done <"$TWITCH_CHANNELS_FILE"
     17 		_describe 'twitch channels' channels
     18 	fi
     19 }
     20 
     21 compdef _twitch_completion tww