Path Input
The path input component asks a user for a Path and gives additional information about a path itself.
@Component
public class ComponentCommands {
private final Terminal terminal;
private final ResourceLoader resourceLoader;
private final TemplateExecutor templateExecutor;
public ComponentCommands(Terminal terminal, ResourceLoader resourceLoader,
TemplateExecutor templateExecutor) {
this.terminal = terminal;
this.resourceLoader = resourceLoader;
this.templateExecutor = templateExecutor;
}
@Command(name = "component path input", description = "Path input", group = "Components")
public String pathInput() {
PathInput component = new PathInput(terminal, "Enter value");
component.setResourceLoader(resourceLoader);
component.setTemplateExecutor(templateExecutor);
PathInputContext context = component.run(PathInputContext.empty());
return "Got value " + context.getResultValue();
}
}
The following screencast shows typical output from a path input component:
The context object is PathInputContext. The following table describes its context variables:
| Key | Description |
|---|---|
|
The parent context variables (see TextComponentContext Template Variables). |