Permalink
Browse files

Create a function named die, use it for error messages

  • Loading branch information...
1 parent aaeb000 commit 098570c171add1d72a70f355847bfa597f937f18 @sionescu sionescu committed May 6, 2012
Showing with 9 additions and 8 deletions.
  1. +9 −8 scripts/release.sh
View
@@ -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
@@ -36,8 +40,7 @@ while [ $# -gt 0 ]; do
shift 2
;;
*)
- echo "Unrecognized argument '$1'"
- exit 1
+ die "Unrecognized argument '$1'"
;;
esac
done
@@ -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

0 comments on commit 098570c

Please sign in to comment.