Flow Components

从 2.1.x 版本开始,一个新的组件模型提供了一种更简单的方法来为常见用例创建更高级别的用户交互,比如以各种形式要求输入。这些通常只是纯文本输入或从列表中选择某项。

Starting from version 2.1.x, a new component model provides an easier way to create higher-level user interaction for the usual use cases, such as asking for input in various forms. These usually are just plain text input or choosing something from a list.

内置组件的模板位于 org/springframework/shell/component 类路径中。

Templates for built-in components are in the org/springframework/shell/component classpath.

内置组件一般遵循以下逻辑:

Built-in components generally follow this logic:

  1. Enter a run loop for user input.

  2. Generate component-related context.

  3. Render the runtime status of a component state.

  4. Exit.

  5. Render the final status of a component state.

Flow 提供了更好的界面,用于定义组件流程,这些组件更适合定义交互式命令流程。

Flow gives better interface for defining the flow of components that are better suited for defining interactive command flows.