Skip to content

Commit

Permalink
WINDUP-1767 CLI to describe what parameters are required: reordering
Browse files Browse the repository at this point in the history
  • Loading branch information
mrizzi committed Nov 9, 2017
1 parent 71b791e commit 0579fa1
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ public CommandResult execute()

sb.append(System.lineSeparator()).append(" Forge Options:").append(System.lineSeparator());

sb.append("-b, --batchMode").append(System.lineSeparator());
sb.append("\t run Forge in batch mode and does not prompt for confirmation (exits immediately after running) ").append(System.lineSeparator());

sb.append("-i, --install GROUP_ID:ARTIFACT_ID[:VERSION]").append(System.lineSeparator());
sb.append("\t install the required addons and exit. ex: `"+Util.WINDUP_CLI_NAME+" -i core-addon-x` or `"+Util.WINDUP_CLI_NAME+" -i org.example.addon:example:1.0.0` ").append(System.lineSeparator());

Expand All @@ -60,9 +63,6 @@ public CommandResult execute()
sb.append("-m, --immutableAddonDir DIR").append(System.lineSeparator());
sb.append("\t add the given directory for use as a custom immutable addon repository (read only) ").append(System.lineSeparator());

sb.append("-b, --batchMode").append(System.lineSeparator());
sb.append("\t run Forge in batch mode and does not prompt for confirmation (exits immediately after running) ").append(System.lineSeparator());

sb.append("-d, --debug").append(System.lineSeparator());
sb.append("\t run Forge in debug mode (wait on port 8000 for a debugger to attach) ").append(System.lineSeparator());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,22 @@ public static Iterable<ConfigurationOption> getWindupConfigurationOptions(Furnac
@Override
public int compare(ConfigurationOption o1, ConfigurationOption o2)
{
return o2.getPriority() - o1.getPriority();
// if the 1st is required and...
if (o1.isRequired())
{
// the 2nd isn't, the 1st is "before" than the 2nd
if (!o2.isRequired()) return -1;
// otherwise if also the 2nd is required, then order is priority-based
else return o2.getPriority() - o1.getPriority();
}
// if the 1st is not required and...
else
{
// the 2nd is, the 1st is "after" than the 2nd
if (o2.isRequired()) return 1;
// otherwise also the 2nd isn't and order is priority-based
else return o2.getPriority() - o1.getPriority();
}
}
});
return results;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,10 @@ public ValidationResult validate(Object valueObj)
{
return ValidationResult.SUCCESS;
}

@Override
public int getPriority()
{
return 8500;
}
}

0 comments on commit 0579fa1

Please sign in to comment.