scripts/nope
2019-11-06 12:08:18 +01:00

49 lines
649 B
Bash
Executable file

#!/bin/sh
usage() {
cat <<EOF
nope
opens files
Usage: nope FILE
Flags:
--help, -h Displays this help
--version, -v Show version and exit
EOF
}
if ! [ -f "$1" ] ; then
echo "File does not exist!"
exit 1
fi
case "$1" in
--help)
usage
exit 1
;;
--version)
echo "nope version 0.1.0"
exit 1
;;
*.pdf)
okular "$@" > /dev/null 2>&1 &
;;
*.html)
firefox "$@" > /dev/null 2>&1 &
;;
*.mp4|*.mp3|*.wav|*.mkv)
vlc "$@" > /dev/null 2>&1 &
;;
*.ods)
libreoffice "$@" > /dev/null 2>&1 &
;;
*.jpg|*.png)
feh "$@" > /dev/null 2>&1 &
;;
*)
echo "No rule for opening this file has been specified"
exit 1
;;
esac