- This is a first commit to add new annotation model
which eventually will replace old legacy annotations
like ShellComponent, ShellMethod, @ShellOption, etc.
- Adds subset of features needed for parity with manual
use of CommandRegistration.
- Relates #637
- Relates #638
- Relates #639
- Relates #640
- Relates #641
- Issue in #622 is that its command type is `String` and internally
some incoming arguments(it's List) were converted to String by
joining with space. This caused one case with help command to get
conversion via spring's ConversionService(CollectionToStringConverter)
which joins by commas. That was we saw in failed example.
- Remove needed joins in CommandParser and let it just pass List which
then works better with ConversionService.
- This then needs a `command` option type change from String to String[]
which it really is as you should be able to give whole command as
an argument.
- Fixes#622
- New OptionNameModifier which is just a Function<String,String> to
modify a name.
- Can be defined per option in CommandRegistration.
- Can be defined as global default as bean.
- Default implementation for common case types is enabled via boot's
config props under spring.shell.option.naming.case-type
- Support facilities for camel, kebab, snake and pascal conversions.
- Fixes#621
- Introduce new error TooManyArgumentsOptionException
and NotEnoughArgumentsOptionException.
- Parser not tracks arity min/max and imposes
if num of option arguments.
- CommandParserExceptionResolver contains better error
message handling for these containing more context
for a user.
- Fixes#614
- This commit modifies CommandParser to better track positional parameters
which previously used to go there for non-recognised options. Now using
relatively dump logic of just checking if first positional parameter starts
with '-' which indicates it's a candidate for a new `UnrecognisedOptionException`
which then would give user an error "Unrecognised option '--xxx'" for example.
- Fixes#601
- Fixes#602
- New annotations ExceptionResolver and ExitCode
- New needed functionality is in classes ExceptionResolverMethodResolver
and MethodCommandExceptionResolver.
- Hook these annotations with StandardMethodTargetRegistrar and Shell classes
- Fixes#597
- There's been no explicit support having argument void type
as you would not be able to use with annotation model but
surely can be wrapped as Type with CommandRegistration.
- For now change CommandInfoModel so that it uses empty string
which is i.e. expected in help options which are just
used as flags.
- It's outside of this commit to change parser to fail if
user gives an argument value for this type of options.
- Fixes#586
- Essentially this commit registeres on default `--help` and
`-h` options to every command and execution short circuits
in presense of help options to help command.
- Add Supplier<CommandRegistration.Builder> as a bean which
can be autowired registration beans.
- Make this common bean customisable via CommandRegistrationCustomizer.
- Change StandardMethodTargetRegistrar to use supplier so that
annotated commands gets common customizations.
- Change sample commands to use supplier.
- Add new group, spring.shell.help to config props.
- Docs changes
- Fixes#582
- Fixes#585
- NonInteractiveShellRunner has a trouble where incoming
argument loses info about "quoted" string which is handled
by OS terminal.
- Add re-quoting in presense of a whitespace so that
jline parser can detect it correctly.
- Fixes#567
- New PatchSearch component
- Allow user to define base directory for search
- Show (using single select list) search results
- Allow user to define search string
- Implement algorithms(start with exact-match and fuzzy-match) from fuzzy search tool (fzf)
- Sample "component path search" and change "component path" to "component path input"
- Fixes#556
- CommandRegistration now has a structure to define
it beind hidden
- Modify relevant parts to filter out hidden commands
- Essentially command is hidden from all other than
command execution
- Sample in e2e tests
- Fixes#416
- BaseComponentContext has new field terminalWidth.
- StringToStyleExpressionRenderer contains new format
for "truncate-" prefixes and this is something
what template can use to instruct max length based
on terminal width.
- Change single/multi selectors to use this feature.
- Fixes#543
- Add exception handling around new interface CommandExceptionResolver
which allows to define a chain of resolvers to process errors before
exception is bubbled up to result handlers.
- Will be foundation to add more sophisticated error handling features
compared to what spring itself have for rest layer.
- Resolver returns CommandHandlingResult holder which further can be
used to make a choice what to print into console and if spesific exit
code should be used in non-interactive mode.
- Exception handling can be defined globally and per command giving
a change for user to customise i.e. error thrown by parser.
- CommandParserExceptionResolver replaces CommandParserExceptionsExceptionResultHandler
and provides more meaninful message for missing options.
- Fixes#503
- Modify CommandParser to convert given option value if its type is defined
- This change makes option default value to behave same as given value
what comes for the actual value in a CommandContext.
- Fixes#548
- This commit fixes two issues.
- Firstly complete with correct option as existing bug was
to wrongly always complete with first option which used
wrong provider.
- Secondly filter out duplicate option proposals giving better
result when options is already in place.
- Fixes#495
- For now port spring-native to framework config.
- 3rd party configs should go somewhere else.
- Fix changes from javax to jakarta.
- Change java settings as we now require jdk 17.
- Fixes#385
- For title styling change from bold,fg:bright-white
to bold which should work better with different
terminal color settings as forcing it into bright white
is a bad idea.
- Fixes#476
- For annotated methods with arguments, change default arity
to zero with booleans and one everything else regardless
if @ShellOption is defined or not.
- OptionArity.ZERO_OR_ONE had wrong upperbound value, change
from MAX to 1.
- These modification should take us a bit closer to old
shell functionality and what ShellOption documents for arity.
- For old functionality I'm referring to method
`add(int a, int b)` and/or having @ShellOption and/or without
arity setting.
- Fixes#446
- Use same interface type in a generic interactive completions
in a method level and option value level.
- Change CompletionResolver to have same function signature
as with options and use CompletionContext to keep
relevant information.
- Fixes#449
- This is a re-implementation of a interactive completion
with breaking changes as it moves away from a direct use
of a MethodParameter in favour of a CommandRegistration
and its option definitions.
- Fixes#449
- Adding a concept of no-tty which in this commit simply
tracks DumbTerminal as jline creates that if there nothing
better.
- For components without tty don't go to interaction loop.
- For new sample show that we can at least manually handle
required option with a flow while command option is not
required.
- Fixes#444
- Bring back some missing functionality which got missing
during the rework to new command model.
- Polish some classes.
- Restore origin sample.
- Add availability things into help templates and its
representation model.
- Fixes#423
- Add theme settings for figures.
- Settings for styles are now in it own class and
ThemeSettings are wrapping those.
- Prefixed formatting string to have `style-` prefix.
- Templates can now use added `figures` dictionary which
is resolved per activated theme.
- Create `dump` theme.
- New `ThemeActive` interface where default impl uses dump
theme if `CI` or `NO_COLOR` env is set.
- Rework existing templates.
- Fixes#442