Command Context

CommandContext 接口可访问当前正在运行的上下文。可以使用它来获取选项的访问权限:

Unresolved include directive in modules/ROOT/pages/appendices/techintro/commandcontext.adoc - include::../../../../../src/test/java/org/springframework/shell/docs/CommandContextSnippets.java[]

如果你需要在 shell 中打印内容,则可以获取 Terminal 并使用其编写器来打印内容:

Unresolved include directive in modules/ROOT/pages/appendices/techintro/commandcontext.adoc - include::../../../../../src/test/java/org/springframework/shell/docs/CommandContextSnippets.java[]