Short Format

简短样式 POSIX 选项通常只是长格式的同义词。如下所示,选项 --arg 等于 -a

  • Programmatic

  • Annotation

  • Legacy Annotation

Unresolved include directive in modules/ROOT/pages/options/short.adoc - include::../../../../src/test/java/org/springframework/shell/docs/ShortOptionSnippets.java[]
Unresolved include directive in modules/ROOT/pages/options/short.adoc - include::../../../../src/test/java/org/springframework/shell/docs/ShortOptionSnippets.java[]
Unresolved include directive in modules/ROOT/pages/options/short.adoc - include::../../../../src/test/java/org/springframework/shell/docs/ShortOptionSnippets.java[]

如果类型定义为标志(这意味着类型是 boolean),则具有组合格式的简短选项十分强大。通过这种方式,您可以将标志的存在定义为 -abc-abc true-abc false

  • Programmatic

  • Annotation

  • Legacy Annotation

Unresolved include directive in modules/ROOT/pages/options/short.adoc - include::../../../../src/test/java/org/springframework/shell/docs/ShortOptionSnippets.java[]
Unresolved include directive in modules/ROOT/pages/options/short.adoc - include::../../../../src/test/java/org/springframework/shell/docs/ShortOptionSnippets.java[]
Unresolved include directive in modules/ROOT/pages/options/short.adoc - include::../../../../src/test/java/org/springframework/shell/docs/ShortOptionSnippets.java[]