Permalink
Browse files

add error_no_arg and error_missing_arg

  • Loading branch information...
1 parent 6225029 commit 4835090607b9d8bb9f8c3e05d211ac39c96ab7ba @soarpenguin committed Feb 13, 2014
Showing with 4 additions and 1 deletion.
  1. +4 −1 bashrc/standard-funcs-sh
View
@@ -1,4 +1,3 @@
-
get_key()
{
[ -t 0 ] && { ## Check whether input is coming from a terminal
@@ -103,6 +102,10 @@ arg()
esac
}
+# Some error messages
+error_no_arg () { die "option ${1%%=*} does not take any arguments"; }
+error_missing_arg () { die "option ${1%%=*} takes an argument"; }
+
die() {
result=$1
shift

0 comments on commit 4835090

Please sign in to comment.