summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcos <cos>2012-05-25 08:36:38 +0200
committercos <cos>2012-12-17 21:12:07 +0100
commitd681d13237dc9b417ac3d84034fb1c5c2c15cc2e (patch)
tree9d445df96466fff3272dff67f339a3d8c6b2efac
parentf3814534aa5a6216457353d7388f93d38798ca1e (diff)
downloadmat-d681d13237dc9b417ac3d84034fb1c5c2c15cc2e.zip
Add error message on unknown commands.
-rwxr-xr-xmat33
1 files changed, 13 insertions, 20 deletions
diff --git a/mat b/mat
index 87b581e..20f065d 100755
--- a/mat
+++ b/mat
@@ -514,36 +514,29 @@ read_recipe_db;
if ($ARGV[0]) {
if ( $ARGV[0] eq "help") {
print "Command failed!\n" unless (cmd_help >= 0);
- }
- if ( $ARGV[0] eq "addrecipe") {
+ } elsif ( $ARGV[0] eq "addrecipe") {
print "Command failed!\n" unless (cmd_addrecipe() >= 0);
- }
- if ( $ARGV[0] eq "editrecipe") {
+ } elsif ( $ARGV[0] eq "editrecipe") {
print "Command failed!\n" unless (cmd_editrecipe($ARGV[1]) >= 0);
- }
- if ( $ARGV[0] eq "showrecipe") {
+ } elsif ( $ARGV[0] eq "showrecipe") {
print "Command failed!\n" unless (cmd_showrecipe($ARGV[1]) >= 0);
- }
- if ( $ARGV[0] eq "movemeal") {
+ } elsif ( $ARGV[0] eq "movemeal") {
print "Command failed!\n" unless (cmd_movemeal($ARGV[1], $ARGV[2]) >= 0);
- }
- if ( $ARGV[0] eq "setmeal") {
+ } elsif ( $ARGV[0] eq "setmeal") {
print "Command failed!\n" unless (cmd_setmeal($ARGV[1], $ARGV[2]) >= 0);
- }
- if ( $ARGV[0] eq "setstate") {
+ } elsif ( $ARGV[0] eq "setstate") {
print "Command failed!\n" unless (cmd_setstate($ARGV[1], $ARGV[2]) >= 0);
- }
- if ( $ARGV[0] eq "randmeal") {
+ } elsif ( $ARGV[0] eq "randmeal") {
print "Command failed!\n" unless (cmd_randmeal($ARGV[1]) >= 0);
- }
- if ( $ARGV[0] eq "showplan") {
+ } elsif ( $ARGV[0] eq "showplan") {
print "Command failed!\n" unless (cmd_showplan($ARGV[1]) >= 0);
- }
- if ( $ARGV[0] eq "postpone") {
+ } elsif ( $ARGV[0] eq "postpone") {
print "Command failed!\n" unless (cmd_postpone($ARGV[1]) >= 0);
- }
- if ( $ARGV[0] eq "shoppinglist") {
+ } elsif ( $ARGV[0] eq "shoppinglist") {
print "Command failed!\n" unless (cmd_shoppinglist($ARGV[1]) >= 0);
+ } else {
+ print "Unknown command $ARGV[0]\n";
+ exit 1;
}
} else {
cmd_showplan;