diff options
author | cos <cos> | 2012-05-25 08:36:38 +0200 |
---|---|---|
committer | cos <cos> | 2012-12-17 21:12:07 +0100 |
commit | d681d13237dc9b417ac3d84034fb1c5c2c15cc2e (patch) | |
tree | 9d445df96466fff3272dff67f339a3d8c6b2efac | |
parent | f3814534aa5a6216457353d7388f93d38798ca1e (diff) | |
download | mat-d681d13237dc9b417ac3d84034fb1c5c2c15cc2e.zip |
Add error message on unknown commands.
-rwxr-xr-x | mat | 33 |
1 files changed, 13 insertions, 20 deletions
@@ -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; |