Skip to content

Commit

Permalink
#834: bugfix for long options of commandlets (#899)
Browse files Browse the repository at this point in the history
  • Loading branch information
hohwille authored Dec 17, 2024
1 parent 52afdd7 commit 35fc679
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {

Expand Down

0 comments on commit 35fc679

Please sign in to comment.