This version is still in development and is not considered stable yet. For the latest stable version, please use Spring Shell 3.4.0! |
Path Search
The path search component asks base directory for scan and optional search expression.
Results are shown in a single select list where user can pick a path.
PathSearchConfig
can be used to customise component behaviour.
PathSearchConfig config = new PathSearch.PathSearchConfig();
config.setMaxPathsShow(5);
config.setMaxPathsSearch(100);
config.setSearchForward(true);
config.setSearchCaseSensitive(false);
config.setSearchNormalize(false);
PathSearch component = new PathSearch(getTerminal(), "Enter value", config);
component.setResourceLoader(getResourceLoader());
component.setTemplateExecutor(getTemplateExecutor());
PathSearchContext context = component.run(PathSearchContext.empty());
return "Got value " + context.getResultValue();
Logic for search is passed as is into algorithms documented in Search Algorithms. |
The following screencast shows typical output from a path search component:
The context object is PathSearchContext
. The following table describes its context variables:
Key | Description |
---|---|
|
The items available for rendering search results. |
|
The parent context variables (see TextComponentContext Template Variables). |