Commit Graph

96 Commits

Author SHA1 Message Date
Janne Valkealahti
3021704c29 Support hidden commands
- 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
2022-10-18 14:51:44 +01:00
Janne Valkealahti
feba345f00 Component text can be truncated
- 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
2022-10-14 17:16:51 +01:00
Janne Valkealahti
4c48017a97 Implement more flexible error handling
- 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
2022-10-14 10:55:05 +01:00
Janne Valkealahti
3fe26025cd Process given values is a parser
- 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
2022-10-14 06:33:44 +01:00
Janne Valkealahti
226b081c1c Upgrade native-build-tools 0.9.14
- Update docs
- Fixes #540
2022-10-03 09:20:49 +01:00
Janne Valkealahti
f2009e2cb3 Move starter modules under starters
- Now all starters are kept under spring-shell-starters dir.
- Fixes #524
2022-09-08 13:12:12 +01:00
Janne Valkealahti
68af0bb804 Move runtime hints from sample to core
- Relates #490
2022-09-07 09:58:25 +01:00
Janne Valkealahti
146f9165ea Fix wrong jni fields in java.nio.Buffer 2022-09-07 08:51:01 +01:00
Janne Valkealahti
a79d2a6c53 Switch sample jni config programmatic
- Now generating jni-config.json via hints to test
  that side instead of having manually crafted file.
- Relates #490
2022-09-06 19:48:02 +01:00
Janne Valkealahti
a9a420df22 Switch to use implementation config
- Now switching to use implementation configuration as it
  works better with aot tooling.
- Relates #470
2022-09-06 19:39:14 +01:00
Janne Valkealahti
52baaa3f86 Use graal metadata repository
- New version 0.1.1 now enabled in sample.
- Remove hibernate validator hints as those are
  in metadata repo.
- Relates #490
2022-08-19 08:09:06 +01:00
Janne Valkealahti
310cbf84a0 Remove old spring-native sample config
- Relates #490
2022-08-19 08:05:17 +01:00
Janne Valkealahti
bb7afdf10f Configure build-info for sample
- e2e tests version command fails without build-info.
- Relates #470
2022-08-17 09:28:38 +01:00
Janne Valkealahti
fee09f9ff5 Integration native build to sample
- This adds a way to build native binary for a sample which
  were missed from original gradle work.
- Relates #470
2022-08-17 08:45:31 +01:00
Janne Valkealahti
c1c1da84db Remove maven build
- Relates #470
2022-08-16 12:48:04 +01:00
Janne Valkealahti
39c4519a3f Add gradle build files
- First set of changes for introduction of a gradle build.
- Relates #470
2022-08-16 10:30:15 +01:00
Janne Valkealahti
a143d25ffc Apply correct completion
- 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
2022-08-04 09:08:11 +01:00
Janne Valkealahti
1ff802d8e0 Add recorded jni-config for windows in sample
- While out of a box *nix don't need spesific native config as is,
  windows is a different story as it needs jna/jansi stuff and i.e.
  jna needs jvm native things which doesn't work without correct
  graal configs.
- Relates #490
2022-07-29 16:24:40 +01:00
Janne Valkealahti
e193ca1d24 Upgrade to Boot 3.x
- 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
2022-07-24 08:07:14 +01:00
Janne Valkealahti
bff7a22b5e Next major development version 2022-07-23 15:57:21 +01:00
Janne Valkealahti
f826f29d77 Next development version 2022-07-23 15:15:17 +01:00
Drevsh
2862cc855e Add default selection to MultiItemSelector
- Added default selection to items
- Added correct styling for disabled but default selected item
- Added missing license header
- Added missing javadoc
- Added default selection to sample/doc code
2022-07-20 08:17:24 +01:00
Janne Valkealahti
643b189fb8 Default boolean arg to false
- In a case where arg is given as boolean and with plain
  @ShellOption (user doesn't define defaults), configure
  arg not to be mandatory and with default value false.
- This brings this spesific case more close how it behave
  in older shell version.
- Having `@ShellOption boolean arg1` it now works as:
    my-shell:>e2e reg default-value-boolean3
    Hello false
    my-shell:>e2e reg default-value-boolean3 --arg1
    Hello true
    my-shell:>e2e reg default-value-boolean3 --arg1 false
    Hello false
    my-shell:>e2e reg default-value-boolean3 --arg1 true
    Hello true
- Fixes #461
2022-07-18 12:41:23 +03:00
Janne Valkealahti
06d9fd51b2 Fix alias usage in help command
- Add info about aliases into model structure used by help
  command templating.
- Add some tests to models.
- Change help commands list to group command and its aliases together.
- Change help command to show aliases.
- Fixes #458
- Fixes #426
2022-07-14 19:17:37 +03:00
Janne Valkealahti
2520e0681f Rework theme sample
- Rename class and commands.
- Changes mostly to make it easier to test things
  out manually when following theming docs.
- Relates #433
2022-07-04 09:53:50 +01:00
Janne Valkealahti
5eaa5dd093 Implement interactive completion
- 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
2022-06-28 14:10:23 +03:00
Janne Valkealahti
195d1d00ab Components can't use interactive mode without tty
- 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
2022-06-15 09:56:14 +01:00
Janne Valkealahti
39c01fe00b Fix availability feature
- 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
2022-06-14 11:51:50 +01:00
Janne Valkealahti
25721dd63d ConfirmationInput should have resultValue
- Add flow hooks to ConfirmationInput so that user
  is able to pass a flag from an options so that
  component can bypass interactive mode.
- Fixes #445
2022-06-13 09:27:16 +01:00
Janne Valkealahti
073cd8562c Rework themes support
- 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
2022-06-10 13:56:21 +01:00
Janne Valkealahti
fa65a2308e Support option label
- This adds `label` to `CommandOption` which is then used
  in a Help instead of type.
- Fixes #424
2022-06-08 07:39:44 +01:00
Janne Valkealahti
0be37d164f Split e2e sample commands 2022-06-02 07:46:43 +01:00
Janne Valkealahti
3891a8b375 Add support for exit codes
- New configurations to CommandRegistration
- Re-using exit code concepts from boot
- Handling exit codes only in non-interactive mode
- Adding e2e commands and tests for better coverage
- Fixes #431
2022-05-31 07:49:50 +01:00
Janne Valkealahti
0fa85cba83 Update boot 2.7.0
- Pump spring-native 0.12.0 as needed by boot 2.7.0
- Fixes #419
2022-05-30 11:10:07 +01:00
Janne Valkealahti
5470e29a9c Add spring release repo to samples
- This is to be able to import project without having
  active spring profile. Basically needed for spring-native
  which is not in central.
2022-05-26 07:48:40 +01:00
Janne Valkealahti
bd9ab62013 Rework help command
- Change help command output to get templated using
  model classes.
- Remove things around ParameterDescription as those are
  replaced with template classes.
- Fixes for native configs.
- For now availability and aliases are removed from
  help to get back in better form.
- Aliases has been partly introduced to structure.
- Fixes #422
2022-05-26 07:45:35 +01:00
Janne Valkealahti
baf8346063 Change help to description in command registration
- Fixes #421
2022-05-18 08:59:57 +01:00
Janne Valkealahti
c7d3eb15b4 Expose CommandRegistration in CommandContext
- Fixes #420
2022-05-18 08:18:38 +01:00
Janne Valkealahti
b119473881 New e2e test 2022-05-18 08:01:24 +01:00
Janne Valkealahti
6a1158dc12 Make history file path configurable
- UserConfigPathProvider interface to provid "user-level"
  config directory which can be used within a shell.
- New options which can be used to configure behaviour.
  spring.shell.history.enabled
  spring.shell.history.name
  spring.shell.config.location
  spring.shell.config.env
- Fixes #417
2022-05-17 18:29:58 +01:00
Janne Valkealahti
7224ee31de Update e2e tests
- Add new e2e group to samples which can be used
  with particular tests.
- Relates #401
2022-05-15 16:29:48 +01:00
Janne Valkealahti
d49429975d Expose default option in SingleItemSelector
- Tweak flow framework so that single item selector
  can be configured with a default item which is then
  "exposed" automatically so that user can just hit enter.
- Fixes #414
2022-05-13 15:38:37 +01:00
Janne Valkealahti
0085df585a Update boot 2.6.7
- Update spring-native 0.11.5 as that should be used with
  boot 2.6.7.
- Fixes #411
2022-05-11 07:49:52 +01:00
Janne Valkealahti
c6a8e1c65c Update e2e tests
- Fix native configs for win in sample app.
- Integrate spring-native with samples app.
- Tweak e2e workflow to upload artifacts and some other generic changes.
- Relates #401
2022-05-08 14:19:35 +01:00
Janne Valkealahti
8a23518b84 Rework command subsystem
- Focus of these changes are to introduce a new command system based on
  real registrations (new way) instead of continuously (old way) resolve
  methods and its parameters via reflection.
- There's a lot of changes as this resolution via reflection had its
  hooks almost everywhere and thus most changes are just refactorings.
- Order to understand real changes I'd start to look classes under
  `org.springframework.shell.command` package as it defines new registration,
  catalog and parser classes. Also samples contain new classes to demonstrate
  new functionality.
- Fixes #380
2022-05-06 08:32:53 +01:00
Janne Valkealahti
4e625feb03 Drop jcommander
- Fixes #395
2022-04-29 15:55:21 +01:00
Janne Valkealahti
30e7c4d370 Add auto-config for ComponentFlow
- ComponentFlowAutoConfiguration which creates a builder bean
  and configures ComponentFlowCustomizer to set needed
  defaults for terminal, resource loader and template executor.
- Fixes #387
2022-03-05 09:37:27 +00:00
Janne Valkealahti
85976cff48 Native support for JCommander
- Fixes #340
2022-03-05 08:18:28 +00:00
Janne Valkealahti
c532dc227e Flow system for UI components
- Implement basic flow system with builder patterns
  to easily use components and hook those together
  as a flow.
- Fixes #364
2022-03-03 15:45:02 +00:00
Janne Valkealahti
7b547e53a8 Add dynamic command registration
- Extend CommandRegistry for add/remove methods.
- For rest of shell classes move to use registry
  directly instead of caching commands as registry
  is not immutable anymore.
- Add new sample
- Fixes #379
2022-02-26 09:26:23 +00:00