程序化

使用 CommandRegistration 的程序化方式是使用 withOption 来定义选项。

CommandRegistration registration = CommandRegistration.builder()
	.withOption()
		.longNames("arg1")
		.and()
	.build();

CommandRegistration 可以定义为 bean,也可以手动注册到 CommandCatalog 中。

查看以下章节了解其他选项类型,即短格式。