File tree Expand file tree Collapse file tree 3 files changed +14
-2
lines changed
src/main/java/org/scijava Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ public void handle(final LinkedList<String> args) {
7474
7575 args .removeFirst (); // --run
7676 final String commandToRun = args .removeFirst ();
77- final String paramString = args . isEmpty ( ) ? "" : args .removeFirst ();
77+ final String paramString = ConsoleUtils . hasParam ( args ) ? "" : args .removeFirst ();
7878
7979 run (commandToRun , paramString );
8080 }
Original file line number Diff line number Diff line change 3232
3333import java .util .HashMap ;
3434import java .util .Iterator ;
35+ import java .util .LinkedList ;
3536import java .util .Map ;
3637
3738import org .scijava .command .CommandInfo ;
@@ -83,4 +84,15 @@ else if (logService != null)
8384 return inputMap ;
8485
8586 }
87+
88+ /**
89+ * Test if the next argument is an appropriate parameter to a
90+ * {@link ConsoleArgument}.
91+ *
92+ * @return {@code true} if the first argument of the given list does not
93+ * start with a {@code '-'} character.
94+ */
95+ public static boolean hasParam (final LinkedList <String > args ) {
96+ return !(args .isEmpty () || args .getFirst ().startsWith ("-" ));
97+ }
8698}
Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ public void handle(final LinkedList<String> args) {
7272
7373 args .removeFirst (); // --run
7474 final String scriptToRun = args .removeFirst ();
75- final String paramString = args . isEmpty ( ) ? "" : args .removeFirst ();
75+ final String paramString = ConsoleUtils . hasParam ( args ) ? "" : args .removeFirst ();
7676
7777 run (scriptToRun , paramString );
7878 }
You can’t perform that action at this time.
0 commit comments