Catalog App

目录应用程序展示了多种使用终端 UI 框架的方法。在这一部分中,我们讨论了这个应用程序如何工作。可以将其视为参考应用程序,因为它使用大多数可用功能并尝试遵循最佳实践。

Catalog application is showing various ways how Terminal UI Framework can be used. In this section we discuss how this application works. It can be considered to be a reference application as it’s using most of the features available and tries to follow best practices.

Create Scenario

基本上,每个 Scenario 都本质上是 View 的示例代码,因为它展示了目录应用程序。在示例应用程序中,在 scenario 包下创建一个新的场景类,并根据以下内容实现该类。

Every Scenario essentially is a sample code of a View as that’s what catalog app demonstrates. In the sample app create a new scenario class under scenario package and implement it as something shown below.

Unresolved include directive in modules/ROOT/pages/appendices/tui/catalog.adoc - include::../../../../../src/test/java/org/springframework/shell/docs/CatalogSnippets.java[]

您需要使用_@ScenarioComponent_定义所有字段“name”、“description”和“category”。

You need to define all fields, name, description and category with @ScenarioComponent.