Path Input
The path input componentasks a user for a Path and gives additional information about a path itself.
public class ComponentCommands {
@Command(name = "component path input", description = "Path input", group = "Components")
public String pathInput() {
PathInput component = new PathInput(getTerminal(), "Enter value");
ResourceLoader resourceLoader = null; // getResourceLoader();
TemplateExecutor templateExecutor = null; // getTemplateExecutor();
component.setResourceLoader(resourceLoader);
component.setTemplateExecutor(templateExecutor);
PathInputContext context = component.run(PathInputContext.empty());
return "Got value " + context.getResultValue();
}
}
将以下屏幕录制展示了路径输入组件典型的输出内容:
The context object是PathInputContext。以下表格描述了其上下文变量:
| 键 | 描述 |
|---|---|
|
The parent context variables (see TextComponentContext 模板变量). |