use of org.gradle.internal.logging.text.LinePrefixingStyledTextOutput in project gradle by gradle.
the class TaskDetailPrinter method printlnCommandlineOptions.
private void printlnCommandlineOptions(StyledTextOutput output, List<Task> tasks) {
List<OptionDescriptor> allOptions = new ArrayList<OptionDescriptor>();
for (Task task : tasks) {
allOptions.addAll(optionReader.getOptions(task));
}
if (!allOptions.isEmpty()) {
output.println();
output.text("Options").println();
}
Map<String, Set<String>> optionToAvailableOptionsValues = optionToAvailableValues(allOptions);
Map<String, String> optionToDescription = optionToDescription(allOptions);
Iterator<String> optionNames = optionToAvailableOptionsValues.keySet().iterator();
while (optionNames.hasNext()) {
String currentOption = optionNames.next();
Set<String> availableValues = optionToAvailableOptionsValues.get(currentOption);
String optionString = "--" + currentOption;
output.text(INDENT).withStyle(UserInput).text(optionString);
output.text(INDENT).text(optionToDescription.get(currentOption));
if (!availableValues.isEmpty()) {
final int optionDescriptionOffset = 2 * INDENT.length() + optionString.length();
final LinePrefixingStyledTextOutput prefixedOutput = createIndentedOutput(output, optionDescriptionOffset);
prefixedOutput.println();
prefixedOutput.println("Available values are:");
for (String value : availableValues) {
prefixedOutput.text(INDENT);
prefixedOutput.withStyle(UserInput).println(value);
}
} else {
output.println();
}
if (optionNames.hasNext()) {
output.println();
}
}
}
Aggregations