This version is still in development and is not considered stable yet. For the latest stable version, please use Spring Shell 3.4.1!

Path Input

The path input component asks 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 following screencast shows typical output from a path input component:

The context object is PathInputContext. The following table describes its context variables:

Table 1. PathInputContext Template Variables
Key Description

model

The parent context variables (see TextComponentContext Template Variables).