Skip to content

Commit

Permalink
Added ARGS_OPTION constant
Browse files Browse the repository at this point in the history
  • Loading branch information
ethauvin committed Aug 14, 2023
1 parent c0418bb commit edc9f65
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
8 changes: 8 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions src/main/java/rife/bld/help/RunHelp.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package rife.bld.help;

import rife.bld.CommandHelp;
import rife.bld.operations.RunOperation;
import rife.tools.StringUtils;

/**
Expand All @@ -19,9 +20,9 @@ public String getSummary() {
}

public String getDescription(String topic) {
return StringUtils.replace("""
return String.format("""
Runs the project.
Usage : ${topic} [--args=ARGUMENT...]""", "${topic}", topic);
Usage : %s [%s=ARG...]""", topic, RunOperation.ARGS_OPTION);
}
}
}
5 changes: 3 additions & 2 deletions src/main/java/rife/bld/operations/RunOperation.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* @since 1.5
*/
public class RunOperation extends AbstractProcessOperation<RunOperation> {
public static final String ARGS_OPTION = "--args=";
protected final List<String> runOptions_ = new ArrayList<>();

/**
Expand Down Expand Up @@ -60,8 +61,8 @@ public RunOperation fromProject(BaseProject project) {
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(" ")));
}
Expand Down

0 comments on commit edc9f65

Please sign in to comment.