Class PathInput
java.lang.Object
org.springframework.shell.component.support.AbstractComponent<C>
org.springframework.shell.component.support.AbstractTextComponent<Path,PathInput.PathInputContext>
org.springframework.shell.component.PathInput
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.context.ResourceLoaderAware
Component for a simple path input.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.shell.component.support.AbstractTextComponent
AbstractTextComponent.BaseTextComponentContext<T,
C extends AbstractTextComponent.TextComponentContext<T, C>>, AbstractTextComponent.TextComponentContext<T, C extends AbstractTextComponent.TextComponentContext<T, C>> -
Field Summary
Fields inherited from class org.springframework.shell.component.support.AbstractComponent
OPERATION_BACKSPACE, OPERATION_CHAR, OPERATION_DOWN, OPERATION_EXIT, OPERATION_SELECT, OPERATION_UP
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetThisContext
(ComponentContext<?> context) Gets a real component context using common this trick.protected boolean
read
(org.jline.keymap.BindingReader bindingReader, org.jline.keymap.KeyMap<String> keyMap, PathInput.PathInputContext context) Read input.protected Path
resolvePath
(String path) Resolves aPath
from a given rawpath
.void
setPathProvider
(Function<String, Path> pathProvider) Sets a path provider.Methods inherited from class org.springframework.shell.component.support.AbstractTextComponent
bindKeyMap, getName, runInternal
Methods inherited from class org.springframework.shell.component.support.AbstractComponent
addPostRunHandler, addPreRunHandler, getTemplateExecutor, getTerminal, hasTty, loop, render, renderTemplateResource, run, runPostRunHandlers, runPreRunHandlers, setPrintResults, setRenderer, setResourceLoader, setTemplateExecutor, setTemplateLocation
-
Constructor Details
-
PathInput
public PathInput(org.jline.terminal.Terminal terminal) -
PathInput
-
PathInput
public PathInput(org.jline.terminal.Terminal terminal, String name, Function<PathInput.PathInputContext, List<org.jline.utils.AttributedString>> renderer)
-
-
Method Details
-
getThisContext
Description copied from class:AbstractComponent
Gets a real component context using common this trick.- Specified by:
getThisContext
in classAbstractComponent<PathInput.PathInputContext>
- Parameters:
context
- the context- Returns:
- a component context
-
read
protected boolean read(org.jline.keymap.BindingReader bindingReader, org.jline.keymap.KeyMap<String> keyMap, PathInput.PathInputContext context) Description copied from class:AbstractComponent
Read input.- Specified by:
read
in classAbstractComponent<PathInput.PathInputContext>
- Parameters:
bindingReader
- the binding readerkeyMap
- the key mapcontext
- the context- Returns:
- true if read is complete, false to stop
-
setPathProvider
Sets a path provider.- Parameters:
pathProvider
- the path provider
-
resolvePath
Resolves aPath
from a given rawpath
.- Parameters:
path
- the raw path- Returns:
- a resolved path
-