Skip to content

Commit d12a764

Browse files
committed
fix issue: command help does not display options when option annotation is put on a field
1 parent d57d576 commit d12a764

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

src/main/java/act/app/CliContext.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -285,13 +285,14 @@ void handle() throws IOException {
285285
boolean help = parser.getBoolean("-h", "--help");
286286
if (help) {
287287
Help.INSTANCE.showHelp(parser.command(), this);
288-
}
289-
try {
290-
handler.handle(this);
291-
} catch ($.Break b) {
292-
throw b;
293-
} catch (Exception e) {
294-
console.println("Error: " + e.getMessage());
288+
} else {
289+
try {
290+
handler.handle(this);
291+
} catch ($.Break b) {
292+
throw b;
293+
} catch (Exception e) {
294+
console.println("Error: " + e.getMessage());
295+
}
295296
}
296297
}
297298

src/main/java/act/cli/meta/CommanderClassMetaInfo.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ public CommanderClassMetaInfo superType(Type type) {
7979
}
8080

8181
public CommanderClassMetaInfo addFieldOptionAnnotationInfo(FieldOptionAnnoInfo info) {
82+
info.paramName(info.fieldName());
8283
fieldOptionAnnoInfoMap.put(info.fieldName(), info);
8384
return this;
8485
}

0 commit comments

Comments
 (0)