mirror of
https://github.com/ethauvin/bld.git
synced 2025-04-26 08:37:11 -07:00
Added support for run arguments
This commit is contained in:
parent
cdaea733b2
commit
061a194322
2 changed files with 19 additions and 1 deletions
|
@ -22,6 +22,6 @@ public class RunHelp implements CommandHelp {
|
||||||
return StringUtils.replace("""
|
return StringUtils.replace("""
|
||||||
Runs the project.
|
Runs the project.
|
||||||
|
|
||||||
Usage : ${topic}""", "${topic}", topic);
|
Usage : ${topic} [--args=ARGUMENT...]""", "${topic}", topic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import rife.bld.BaseProject;
|
||||||
import rife.tools.FileUtils;
|
import rife.tools.FileUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,6 +36,7 @@ public class RunOperation extends AbstractProcessOperation<RunOperation> {
|
||||||
}
|
}
|
||||||
args.add(mainClass());
|
args.add(mainClass());
|
||||||
args.addAll(runOptions());
|
args.addAll(runOptions());
|
||||||
|
System.out.println(args);
|
||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,6 +54,22 @@ public class RunOperation extends AbstractProcessOperation<RunOperation> {
|
||||||
if (project.usesRife2Agent()) {
|
if (project.usesRife2Agent()) {
|
||||||
operation.javaOptions().javaAgent(project.getRife2AgentFile());
|
operation.javaOptions().javaAgent(project.getRife2AgentFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// parse the run arguments if any
|
||||||
|
var args = project.arguments();
|
||||||
|
while (!args.isEmpty()) {
|
||||||
|
var arg = args.get(0);
|
||||||
|
if (arg.startsWith("-")) {
|
||||||
|
args.remove(0);
|
||||||
|
if (arg.startsWith("--args=")) {
|
||||||
|
var runArgs = arg.substring(7);
|
||||||
|
if (!runArgs.isBlank()) {
|
||||||
|
runOptions_.addAll(0, Arrays.asList(runArgs.split(" ")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return operation;
|
return operation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue