Skip to content

Commit

Permalink
devonfw#1509 Implemented requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Mansour Dukhan committed May 25, 2022
1 parent a07f34c commit f5a490c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ public class AdaptTemplatesCommand extends CommandCommons {
private static Logger LOG = LoggerFactory.getLogger(CobiGenCLI.class);

/**
* If this options is enabled, all templates are unpacked.
* If this options is enabled, all templates are extracted.
*/
@Option(names = { "--all" }, negatable = true, description = MessagesConstants.UPDATE_ALL_DESCRIPTION)
@Option(names = { "--all" }, negatable = true, description = MessagesConstants.ADAPT_ALL_DESCRIPTION)
boolean adaptAll;

@Override
Expand Down Expand Up @@ -82,12 +82,13 @@ private List<Path> getJarsToAdapt(TemplateAdapter templateAdapter, List<Path> te

List<String> userSelection = new ArrayList<>();

if (this.adaptAll)
if (this.adaptAll) {
userSelection.add("0");
else
} else {
for (String templateSelection : ValidationUtils.getUserInput().split(",")) {
userSelection.add(templateSelection);
}
}

if (userSelection.contains("0")) {
jarsToAdapt = templateJars;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ public class MessagesConstants {
*/
public static final String ADAPT_TEMPLATES_DESCRIPTION = "Generates a new templates folder next to the cobigen cli";

/**
* Message constant: description of the adapt-templates --all command
*/
public static final String ADAPT_ALL_DESCRIPTION = "If this option is enabled, all templates will get adapted.";

/**
* Message constant: description of the custom-location option
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public static void throwNoTriggersMatched(Path inputFile, boolean isJavaInput, b
public static String getUserInput() {

String userInput = "";
userInput = inputReader.nextLine();
userInput = inputReader.nextLine();
return userInput;
}

Expand Down

0 comments on commit f5a490c

Please sign in to comment.