| 此版本仍在开发中,尚未被视为稳定版本。对于最新的稳定版本,请使用 Spring Shell 3.3.3! | 
可选值
选项是必需的或不是,一般来说,它的行为方式取决于 命令目标。
将 option 设为 optional。
- 
Programmatic 
- 
Annotation 
- 
Legacy Annotation 
CommandRegistration optionalOption() {
	return CommandRegistration.builder()
		.command("optionalOption")
		.withOption()
			.longNames("arg")
			.required(false)
			.and()
		.build();
}void optionalOption(
	@Option(required = false) String arg
) {
}void optionalOption(
	@ShellOption(defaultValue = ShellOption.NULL) String arg
) {
}将选项设为必填项。
- 
Programmatic 
- 
Annotation 
- 
Legacy Annotation 
CommandRegistration mandatoryOption() {
	return CommandRegistration.builder()
		.command("optionalOption")
		.withOption()
			.longNames("arg")
			.required()
			.and()
		.build();
}void mandatoryOption(
	@Option(required = true) String arg
) {
}void mandatoryOption(
	@ShellOption() String arg
) {
}