mirror of
https://github.com/ethauvin/bld.git
synced 2025-04-25 16:27:11 -07:00
Added ARGS_OPTION constant
This commit is contained in:
parent
c0418bb60a
commit
ecb72b6a7d
4 changed files with 17 additions and 9 deletions
|
@ -5,7 +5,7 @@
|
|||
package rife.bld.help;
|
||||
|
||||
import rife.bld.CommandHelp;
|
||||
import rife.tools.StringUtils;
|
||||
import rife.bld.operations.RunOperation;
|
||||
|
||||
/**
|
||||
* Provides help for the run command.
|
||||
|
@ -19,9 +19,9 @@ public class RunHelp implements CommandHelp {
|
|||
}
|
||||
|
||||
public String getDescription(String topic) {
|
||||
return StringUtils.replace("""
|
||||
Runs the project.
|
||||
|
||||
Usage : ${topic} [--args=ARGUMENT...]""", "${topic}", topic);
|
||||
return String.format("""
|
||||
Runs the project.
|
||||
|
||||
Usage : %s [%s=ARG...]""", topic, RunOperation.ARGS_OPTION);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,6 +18,7 @@ import java.util.List;
|
|||
* @since 1.5
|
||||
*/
|
||||
public class RunOperation extends AbstractProcessOperation<RunOperation> {
|
||||
public static final String ARGS_OPTION = "--args=";
|
||||
protected final List<String> runOptions_ = new ArrayList<>();
|
||||
|
||||
/**
|
||||
|
@ -60,8 +61,8 @@ public class RunOperation extends AbstractProcessOperation<RunOperation> {
|
|||
var arg = args.get(0);
|
||||
if (arg.startsWith("-")) {
|
||||
args.remove(0);
|
||||
if (arg.startsWith("--args=")) {
|
||||
var runArgs = arg.substring(7);
|
||||
if (arg.startsWith(ARGS_OPTION)) {
|
||||
var runArgs = arg.substring(ARGS_OPTION.length());
|
||||
if (!runArgs.isBlank()) {
|
||||
runOptions_.addAll(0, Arrays.asList(runArgs.split(" ")));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue