103 Commits

Author SHA1 Message Date
github-actions[bot]
2121d7ade6 Next development version 2023-11-28 08:12:31 +00:00
github-actions[bot]
fac2128c54 Next development version 2023-11-08 08:59:48 +00:00
github-actions[bot]
75b8887ade Next development version 2023-10-03 12:02:17 +00:00
github-actions[bot]
9dcd6207bf Next development version 2023-07-26 11:43:32 +00:00
github-actions[bot]
02c3999508 Next development version 2023-06-27 07:00:52 +00:00
github-actions[bot]
b8dece2ee2 Next development version 2023-05-25 15:12:52 +00:00
github-actions[bot]
b4d1039cbe Next development version 2023-05-08 08:02:12 +00:00
github-actions[bot]
8572eeef93 Next development version 2023-04-11 17:35:48 +00:00
Janne Valkealahti
041cb30eb0 Fix option type parsing
- In `CommandRegistration` add `ResolvableType` for `OptionSpec` giving
  more spesific handling of a type.
- In `CommandParser` handle source and target types so that we
  have generics with `List`, `Set` and arrays working better.
- In `HandlerMethodArgumentResolver` add better handling for
  `ConversionService` for generic types.
- In `StandardMethodTargetRegistrar` add better types via `ResolvableType`
  now that `CommandRegistration` support it.
- In `OptionConversionCommands` remove converter from `String` to `Set` as
  now things should work as is if generic in a `Set` has a converter.
- Fixes #694
2023-04-02 14:37:08 +01:00
Simon Verhoeven
3c090848bf Rename setMaskCharater to setMaskCharacter
- Backport #686
- Fixes #689
2023-03-12 16:12:28 +00:00
github-actions[bot]
b4f2598417 Next development version 2023-02-27 17:26:44 +00:00
Janne Valkealahti
7ec5c194ff Use correct type with set
- When target is set and only one option argument is given,
  we should not convert to list as user expects string to xxx
  Converter to work.
- This is how it used to work and previous changes caused
  regression.
- Bug is actually in an old parser and new parser works fine.
- Backport #667
- Fixes #669
2023-02-18 14:21:08 +00:00
github-actions[bot]
61ab2de48c Next development version 2023-01-24 09:28:38 +00:00
Janne Valkealahti
21d695f68e Fix sample commands
- Fix mistake made in backport #631 which
  caused compile issues.
2023-01-19 18:01:27 +00:00
Janne Valkealahti
1bc26c7e17 Handle collection types in a parser
- Handle any option collection type so that list is generated for
  values, this then works well when actual type conversions happen.
- Backport #630
- Fixes #631
2023-01-19 17:34:43 +00:00
Janne Valkealahti
78da071e86 Document String array option type
- Backport #558 as it brings missing option type docs
- Backport #628
- Fixes #629
2023-01-19 11:59:53 +00:00
Janne Valkealahti
7c91782841 Revisit positional arguments
- Add better mapping logic
- Add better type conversion
- More docs for arity and positional option configuration
- Backport #616
- Fixes #617
2023-01-13 17:56:24 +00:00
Janne Valkealahti
4381c2423e Handle arity errors
- Introduce new error TooManyArgumentsOptionException
  and NotEnoughArgumentsOptionException.
- Parser not tracks arity min/max and imposes
  if num of option arguments.
- Backport #614
- Fixes #615
- Original commit this sources had some additional changes
  which is not possible to merge.
2023-01-13 17:53:54 +00:00
Janne Valkealahti
6e3d43c549 Fix sample
- Remove use of CommandRegistration.Builder supplier
- #618
2023-01-13 17:40:31 +00:00
github-actions[bot]
8179401268 Next development version 2023-01-10 14:47:40 +00:00
Janne Valkealahti
38acd79b83 Add unrecognised option support
- 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.
- Backport #601
- Backport #602
- Fixes #603
- Fixes #604
2023-01-07 09:08:15 +00:00
github-actions[bot]
14aa6f1703 Next development version 2022-12-01 16:10:00 +00:00
github-actions[bot]
3e5eac7008 Next development version 2022-10-24 06:52:51 +00:00
Janne Valkealahti
27f8802ebc 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.
- Backport #548
- Fixes #549
2022-10-14 06:44:35 +01:00
github-actions[bot]
685af2e3da Next development version 2022-10-04 13:54:37 +00:00
Janne Valkealahti
9087692999 Next development version 2022-08-19 14:39:33 +01:00
Janne Valkealahti
d6ab2e5f9b 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.
- Backport #495
- Fixes #498

(cherry picked from commit a143d25ffc)
2022-08-04 09:09:35 +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