Path Input

The path input component asks a user for a Path and gives additional information about a path itself.spring-doc.cn

@ShellComponent
public class ComponentCommands extends AbstractShellComponent {

	@ShellMethod(key = "component path input", value = "Path input", group = "Components")
	public String pathInput() {
		PathInput component = new PathInput(getTerminal(), "Enter value");
		component.setResourceLoader(getResourceLoader());
		component.setTemplateExecutor(getTemplateExecutor());
		PathInputContext context = component.run(PathInputContext.empty());
		return "Got value " + context.getResultValue();
	}
}

The following screencast shows typical output from a path input component:spring-doc.cn

The context object is PathInputContext. The following table describes its context variables:spring-doc.cn

Table 1. PathInputContext Template Variables
Key Description

modelspring-doc.cn

The parent context variables (see TextComponentContext Template Variables).spring-doc.cn