diff --git a/cli/src/main/java/com/devonfw/tools/ide/commandlet/CommandletManagerImpl.java b/cli/src/main/java/com/devonfw/tools/ide/commandlet/CommandletManagerImpl.java index bfce6451d..7442bcbfc 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/commandlet/CommandletManagerImpl.java +++ b/cli/src/main/java/com/devonfw/tools/ide/commandlet/CommandletManagerImpl.java @@ -135,8 +135,9 @@ protected void add(Commandlet commandlet) { if (keyword != null) { String name = keyword.getName(); registerKeyword(name, commandlet); - if (name.startsWith("--")) { - registerKeyword(name.substring(2), commandlet); + String optionName = keyword.getOptionName(); + if (!optionName.equals(name)) { + registerKeyword(optionName, commandlet); } String alias = keyword.getAlias(); if (alias != null) { diff --git a/cli/src/main/java/com/devonfw/tools/ide/property/KeywordProperty.java b/cli/src/main/java/com/devonfw/tools/ide/property/KeywordProperty.java index fd615e876..55ea995b3 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/property/KeywordProperty.java +++ b/cli/src/main/java/com/devonfw/tools/ide/property/KeywordProperty.java @@ -34,6 +34,14 @@ private static String getNormalizedName(String name) { return name; } + /** + * @return the option name (e.g. "--help") or the {@link #getName() name} if not an option (e.g. "install"). + */ + public String getOptionName() { + + return this.optionName; + } + @Override public boolean isValue() {