Handle option void type
- There's been no explicit support having argument void type as you would not be able to use with annotation model but surely can be wrapped as Type with CommandRegistration. - For now change CommandInfoModel so that it uses empty string which is i.e. expected in help options which are just used as flags. - It's outside of this commit to change parser to fail if user gives an argument value for this type of options. - Fixes #586
This commit is contained in:
@@ -230,4 +230,26 @@ public class OptionTypeCommands extends BaseE2ECommands {
|
||||
.and()
|
||||
.build();
|
||||
}
|
||||
|
||||
//
|
||||
// Void
|
||||
//
|
||||
|
||||
@Bean
|
||||
public CommandRegistration optionTypeVoidRegistration(Supplier<CommandRegistration.Builder> builder) {
|
||||
return builder.get()
|
||||
.command(REG, "option-type-void")
|
||||
.group(GROUP)
|
||||
.withOption()
|
||||
.longNames("arg1")
|
||||
.type(void.class)
|
||||
.and()
|
||||
.withTarget()
|
||||
.function(ctx -> {
|
||||
return "Hello ";
|
||||
})
|
||||
.and()
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user