For the latest stable version, please use Spring Shell 3.3.1!

Path Input

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

@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:

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).