Confirmation

确认组件要求用户进行一个简单的确认。它本质上是一个“是”或“否”的问题。

link:../../../../../src/test/java/org/springframework/shell/docs/UiComponentSnippets.java[role=include]

以下屏幕截图展示了确认组件的典型输出:

link:example$component-confirmation-1.cast[role=include]

上下文对象是 ConfirmationInputContext。以下表格描述了它的上下文变量:

Table 1. ConfirmationInputContext Template Variables
Key Description

defaultValue

默认值 - truefalse

model

父上下文变量(请参阅 TextComponentContext Template Variables)。