zsh/aliases/mpd

27 lines
451 B
Plaintext
Raw Permalink Normal View History

2016-07-22 14:01:35 +00:00
#!/bin/zsh
2023-03-20 11:54:12 +00:00
mpd-host() {
case "$1" in
set)
echo "MPD_HOST='$2';MPD_PORT='$3'" > ~/.cache/mpd-host.zsh
;;
get)
if [ ! -f ~/.cache/mpd-host.zsh ]; then
echo "MPD_HOST='localhost';MPD_PORT='6600'" > ~/.cache/mpd-host.zsh
fi
cat ~/.cache/mpd-host.zsh
;;
*)
echo "Usage: mpd-host set HOST PORT"
echo " mpd-host get"
;;
esac
}
2016-07-22 14:01:35 +00:00
mpc() {
eval $(mpd-host get)
export MPD_HOST
export MPD_PORT
command mpc "$@"
}