Skip to content

Commit

Permalink
Create a function named die, use it for error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
sionescu committed May 6, 2012
1 parent aaeb000 commit 098570c
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions scripts/release.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
#!/bin/bash

function die() {
echo -e "$@" >&2
exit 1
}

if [ "$(uname -s)" = "Darwin" ]; then
echo "Darwin not supported due to incompatible texinfo, sed, and expr."
exit
die "Darwin not supported due to incompatible texinfo, sed, and expr."
fi

### Configuration
Expand Down Expand Up @@ -36,8 +40,7 @@ while [ $# -gt 0 ]; do
shift 2
;;
*)
echo "Unrecognized argument '$1'"
exit 1
die "Unrecognized argument '$1'"
;;
esac
done
Expand All @@ -46,10 +49,8 @@ done

if ! git diff --exit-code; then
echo -n "Unrecorded changes. "
if [ "$FORCE" -ne 1 ]; then
echo "Aborting."
echo "Use -f or --force if you want to make a release anyway."
exit 1
if [ "$FORCE" -ne 1 ]; then
die "Aborting.\nUse -f or --force if you want to make a release anyway."
else
echo "Continuing anyway."
fi
Expand Down

0 comments on commit 098570c

Please sign in to comment.