標籤

“選項標籤”在shell本身中沒有其他功能行為,除了預設的`help`命令輸出。在命令文件中會記錄選項的型別,但這並不總是超級有用。因此,您可能希望為選項提供更好的描述性詞語。

`legacy annotation`不支援標籤。
  • 程式設計式

  • 註解

CommandRegistration labelOption() {
	return CommandRegistration.builder()
		.withOption()
			.longNames("arg")
			.label("MYLABEL")
			.and()
		.build();
}
void labelOption(
	@Option(label = "MYLABEL") String arg
) {
}

定義標籤後會顯示在`help`中。

my-shell:>help labelOption
NAME
       labelOption -

SYNOPSIS
       labelOption --arg MYLABEL

OPTIONS
       --arg MYLABEL
       [Optional]
© . This site is unofficial and not affiliated with VMware.