Clean up usage and add --help

This commit is contained in:
Alex Malinovich 2017-02-25 19:59:01 -08:00
commit 32b19dfbcb

View file

@ -98,14 +98,15 @@ usage() {
echo " -v Show additional debug information"
echo ""
echo " Long Argument Options:"
echo " --check-update Check for new version of plex only"
echo " --config <path/to/config/file> Configuration file to use"
echo " --dldir <path/to/download/dir> Download directory to use"
echo " --email <plex.tv email> Plex.TV email address"
echo " --pass <plex.tv password> Plex.TV password"
echo " --server <Plex server address> Address of Plex Server"
echo " --port <Plex server port> Port for Plex Server. Used with --server"
echo " --help This help"
echo " --notify-success Set exit code 10 if update is available/installed"
echo " --check-update Check for new version of plex only"
echo " --pass <plex.tv password> Plex.TV password"
echo " --port <Plex server port> Port for Plex Server. Used with --server"
echo " --server <Plex server address> Address of Plex Server"
echo ""
exit 0
}
@ -125,7 +126,7 @@ trap cleanup EXIT
# Parse commandline
ALLARGS=( "$@" )
optstring="-o acCdfFhlpPqrSsuUv -l config:,dldir:,email:,pass:,server:,port:,notify-success,check-update"
optstring="-o acCdfFhlpPqrSsuUv -l config:,dldir:,email:,pass:,server:,port:,notify-success,check-update,help"
GETOPTRES=$(getopt $optstring -- "$@")
if [ $? -eq 1 ]; then
exit 1
@ -183,6 +184,7 @@ do
(--pass) shift; PASS=$(trimQuotes ${1});;
(--server) shift; PLEXSERVER=$(trimQuotes ${1});;
(--port) shift; PLEXPORT=$(trimQuotes ${1});;
(--help) usage;;
(--notify-success) NOTIFY=yes;;
(--check-update) CHECKONLY=yes;;