[otrs-cvs] module-tools ModuleCode.pl,1.1,1.2

"CVS commits notifications of OTRS.org" <[email protected]>
Newsgroups gmane.comp.otrs.cvs
Message-ID <[email protected]>
Comments:
Update of /home/cvs/module-tools
In directory lancelot:/tmp/cvs-serv17505

Modified Files:
	ModuleCode.pl 
Log Message:
Small improvements to 'Amazing Carlos's ModuleCode script.

Author: mb

Index: ModuleCode.pl
===================================================================
RCS file: /home/cvs/module-tools/ModuleCode.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -2 -u -d -r1.1 -r1.2
--- ModuleCode.pl	3 Jan 2013 01:29:32 -0000	1.1
+++ ModuleCode.pl	8 Jan 2013 19:26:45 -0000	1.2
@@ -48,5 +48,5 @@
 getopt( 'h', \%Opt );
 
-if ( exists $Opt{h} ) {
+if ( exists $Opt{h} || !$ARGV[1] ) {
     Usage();
     exit;
@@ -57,5 +57,5 @@
 my $Action;
 
-POSIBLEACTION:
+POSSIBLEACTION:
 for my $PossibleAction (qw(Install Reinstall Upgrade Uninstall)) {
     if ( $UserAction =~ m{\A \Q$PossibleAction\E \z}msxi ) {
@@ -66,10 +66,11 @@
         #add Code Prefix
         $Action = 'Code' . $Action;
-        last POSIBLEACTION;
+        last POSSIBLEACTION;
     }
 }
 
 if ( !$Action ) {
-    print "Action $UserAction is invalid!\n";
+    print "Action '$UserAction' is invalid!\n";
+    Usage();
     exit 0;
 }
@@ -85,4 +86,5 @@
 my $UserType = shift;
 my $Type;
+
 if ($UserType) {
     TYPE:
@@ -93,9 +95,10 @@
             # change to correct case
             $Type = lc $UserType;
-            last POSIBLEACTION;
+            last TYPE;
         }
     }
-    if ($Type) {
-        print "The type $UserType is invalid!\n";
+    if ( !$Type ) {
+        print "Type '$UserType' is invalid!\n";
+        Usage();
         exit 0;
     }
---------------------------------------------------------------------
OTRS mailing list: cvs-log - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/cvs-log
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/cvs-log
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.