From f5a490c3694d36738c2373656134ac805219032e Mon Sep 17 00:00:00 2001 From: Mansour Dukhan Date: Wed, 25 May 2022 13:41:21 +0200 Subject: [PATCH] #1509 Implemented requested changes --- .../cobigen/cli/commands/AdaptTemplatesCommand.java | 9 +++++---- .../devonfw/cobigen/cli/constants/MessagesConstants.java | 5 +++++ .../com/devonfw/cobigen/cli/utils/ValidationUtils.java | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/cobigen-cli/cli/src/main/java/com/devonfw/cobigen/cli/commands/AdaptTemplatesCommand.java b/cobigen-cli/cli/src/main/java/com/devonfw/cobigen/cli/commands/AdaptTemplatesCommand.java index 93b1b69d02..d20464b870 100644 --- a/cobigen-cli/cli/src/main/java/com/devonfw/cobigen/cli/commands/AdaptTemplatesCommand.java +++ b/cobigen-cli/cli/src/main/java/com/devonfw/cobigen/cli/commands/AdaptTemplatesCommand.java @@ -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 @@ -82,12 +82,13 @@ private List getJarsToAdapt(TemplateAdapter templateAdapter, List te List 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; diff --git a/cobigen-cli/cli/src/main/java/com/devonfw/cobigen/cli/constants/MessagesConstants.java b/cobigen-cli/cli/src/main/java/com/devonfw/cobigen/cli/constants/MessagesConstants.java index 9c63da3f73..84c98dcce8 100644 --- a/cobigen-cli/cli/src/main/java/com/devonfw/cobigen/cli/constants/MessagesConstants.java +++ b/cobigen-cli/cli/src/main/java/com/devonfw/cobigen/cli/constants/MessagesConstants.java @@ -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 */ diff --git a/cobigen-cli/cli/src/main/java/com/devonfw/cobigen/cli/utils/ValidationUtils.java b/cobigen-cli/cli/src/main/java/com/devonfw/cobigen/cli/utils/ValidationUtils.java index bead649d10..3c90e493fd 100644 --- a/cobigen-cli/cli/src/main/java/com/devonfw/cobigen/cli/utils/ValidationUtils.java +++ b/cobigen-cli/cli/src/main/java/com/devonfw/cobigen/cli/utils/ValidationUtils.java @@ -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; }