Skip to content

Commit

Permalink
Print usage message (if necessary) *before* checking requisites.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tblue committed Apr 4, 2015
1 parent 536471d commit 8dde13d
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions create_omtb_garmin_img.sh
Expand Up @@ -45,6 +45,19 @@ zparseopts -A ARGS_A -D -E -- "g:" "m:" "o:"
OMTB_EXE="$1"
TYPFILE="$2"

[[ -z $TYPFILE || ! -f $OMTB_EXE ]] && usage

if [[ ${OMTB_EXE:t} == mtb* ]]; then
OMTBORVELO=openmtbmap
OMTB_NAME="${OMTB_EXE:t:r:s/mtb/}"
elif [[ ${OMTB_EXE:t} == velo* ]]; then
OMTBORVELO=openvelomap
OMTB_NAME="${OMTB_EXE:t:r:s/velo/}"
elif [[ -n ${OMTB_EXE:t} ]]; then
print "\nERROR: Not a openmtbmap.org or openvelomap.org file ?" > /dev/stderr
usage
fi

GMT_CMD=( ${ARGS_A[-g]}(.N,@-.) ${^path}/gmt(.N,@-.) )
GMT_CMD="${GMT_CMD[1]}"

Expand All @@ -70,19 +83,6 @@ if ! [[ -x =7z ]]; then
exit 3
fi

if [[ ${OMTB_EXE:t} == mtb* ]]; then
OMTBORVELO=openmtbmap
OMTB_NAME="${OMTB_EXE:t:r:s/mtb/}"
elif [[ ${OMTB_EXE:t} == velo* ]]; then
OMTBORVELO=openvelomap
OMTB_NAME="${OMTB_EXE:t:r:s/velo/}"
elif [[ -n ${OMTB_EXE:t} ]]; then
print "\nERROR: Not a openmtbmap.org or openvelomap.org file ?" > /dev/stderr
usage
fi

[[ -z $TYPFILE || ! -f $OMTB_EXE ]] && usage

DESC="${OMTBORVELO}_${OMTB_NAME}"
if [[ -d ${ARGS_A[-o]} ]]; then
DSTFILENAME="${ARGS_A[-o]:A}/${DESC}.img"
Expand Down

0 comments on commit 8dde13d

Please sign in to comment.