David Krentzlin avatar David Krentzlin committed 0bbbfb8 Draft

more refinements

Comments (0)

Files changed (1)

mira.core/src/processor.lisp

     (let* ((argument-list (argument-string->argument-list argument-string))
 	   (cmd-closure   (body command))
 	   (cmd-opts      (command-line-options command))
-	   (first-arg     (car argument-list)))
+	   (first-arg     (car argument-list))
+	   (no-args-ok    (allow-no-args command)))
       (if (and first-arg (stringp first-arg) (equal (string-downcase (car argument-list)) "help"))
           (cmd-answer command-env (help command))
 	  (handler-case 
-	      (progn
-		(if (and (not argument-list) (not (no-args-allowed command)))
-		    (cmd-answer command-env (usage command))
-		    (if cmd-opts
-			(multiple-value-bind (args options errors) (getopt argument-list cmd-opts)
-			  (if errors
-			      (cmd-answer command-env (usage command))
-			      (apply cmd-closure command-env options args)))
-			(apply cmd-closure command-env nil argument-list))))
+	      (progn		
+		(multiple-value-bind (args options errors) (getopt argument-list cmd-opts)
+		  (if (or errors (and (not no-args-ok (not args))))
+		      (cmd-answer command-env (usage command))
+		      (apply cmd-closure command-env options args)))
+		(apply cmd-closure command-env nil argument-list))
 	     (error ()
 	       (format t "Have an error~%")
 	       (cmd-answer command-env (usage command))))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.