4848 Main .Search .class ,
4949 Main .Install .class ,
5050 Main .PrintPath .class ,
51- Main .Do .class ,
52- Main .Run .class
51+ Main .Do .class
5352 })
5453public class Main {
5554
@@ -318,26 +317,26 @@ public Integer call() throws Exception {
318317 @ Command (
319318 name = "do" ,
320319 description =
321- "Executes a script command defined in the app.yml file. Scripts can use variable substitution for classpath.\n \n "
320+ "Executes an action command defined in the app.yml file. Actions can use variable substitution for classpath.\n \n "
322321 + "Example:\n jpm do build\n jpm do test\n " )
323322 static class Do implements Callable <Integer > {
324323 @ Mixin CopyMixin copyMixin ;
325324
326325 @ Parameters (
327- paramLabel = "scriptName " ,
328- description = "Name of the script to execute as defined in app.yml" ,
326+ paramLabel = "actionName " ,
327+ description = "Name of the action to execute as defined in app.yml" ,
329328 arity = "1" )
330- private String scriptName ;
329+ private String actionName ;
331330
332331 @ Override
333332 public Integer call () throws Exception {
334333 AppInfo appInfo = AppInfo .read ();
335- String command = appInfo .getScript ( scriptName );
334+ String command = appInfo .getAction ( actionName );
336335
337336 if (command == null ) {
338- System .err .println ("Script '" + scriptName + "' not found in app.yml" );
339- if (!appInfo .getScriptNames ().isEmpty ()) {
340- System .err .println ("Available scripts : " + String .join (", " , appInfo .getScriptNames ()));
337+ System .err .println ("Action '" + actionName + "' not found in app.yml" );
338+ if (!appInfo .getActionNames ().isEmpty ()) {
339+ System .err .println ("Available actions : " + String .join (", " , appInfo .getActionNames ()));
341340 }
342341 return 1 ;
343342 }
@@ -359,43 +358,7 @@ public Integer call() throws Exception {
359358 }
360359 }
361360
362- @ Command (
363- name = "run" ,
364- description =
365- "Alias for 'jpm do run'. Executes the 'run' script defined in the app.yml file.\n \n "
366- + "Example:\n jpm run\n " )
367- static class Run implements Callable <Integer > {
368- @ Mixin CopyMixin copyMixin ;
369-
370- @ Override
371- public Integer call () throws Exception {
372- AppInfo appInfo = AppInfo .read ();
373- String command = appInfo .getScript ("run" );
374-
375- if (command == null ) {
376- System .err .println ("Script 'run' not found in app.yml" );
377- if (!appInfo .getScriptNames ().isEmpty ()) {
378- System .err .println ("Available scripts: " + String .join (", " , appInfo .getScriptNames ()));
379- }
380- return 1 ;
381- }
382-
383- // Get the classpath for variable substitution using app.yml dependencies
384- List <Path > classpath = Collections .emptyList ();
385- try {
386- classpath = Jpm .builder ()
387- .directory (copyMixin .directory )
388- .noLinks (copyMixin .noLinks )
389- .build ()
390- .path (new String [0 ]); // Empty array means use dependencies from app.yml
391- } catch (Exception e ) {
392- // If we can't get the classpath, continue with empty list
393- System .err .println ("Warning: Could not resolve classpath: " + e .getMessage ());
394- }
395361
396- return ScriptUtils .executeScript (command , classpath );
397- }
398- }
399362
400363 static class CopyMixin {
401364 @ Option (
@@ -462,8 +425,8 @@ public static void main(String... args) {
462425 // Handle common aliases
463426 if (args .length > 0 ) {
464427 String firstArg = args [0 ];
465- if ("compile" .equals (firstArg ) || "test" .equals (firstArg )) {
466- // Convert "jpm compile" to "jpm do compile" and "jpm test " to "jpm do test "
428+ if ("compile" .equals (firstArg ) || "test" .equals (firstArg ) || "run" . equals ( firstArg ) ) {
429+ // Convert "jpm compile", "jpm test", "jpm run " to "jpm do <command> "
467430 String [] newArgs = new String [args .length + 1 ];
468431 newArgs [0 ] = "do" ;
469432 System .arraycopy (args , 0 , newArgs , 1 , args .length );
0 commit comments