Commit Graph

770 Commits

Author SHA1 Message Date
Janne Valkealahti
fbbfd7b9c9 Update issue handler for prs 2023-04-06 08:45:33 +01:00
Janne Valkealahti
2e19929a32 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.
- Backport #694 #699
- Fixes #700
2023-04-05 18:56:09 +01:00
Janne Valkealahti
64abc1da22 Fix positional args with new parser
- Better alignment for use of positional args without using
  an option.
- Should work similarly with old parsing framework.
- Change position where missing options are checked.
- Fixes #701
2023-04-05 13:42:22 +01:00
Janne Valkealahti
a3a6c0e15a Update labels 2023-04-01 14:23:08 +01:00
Janne Valkealahti
e7b4c82e34 Upgrade spring-boot 3.1.0-M2
- Fixes #697
2023-03-24 16:06:34 +00:00
Janne Valkealahti
575d95428b Update docs copyright year 2023-03-18 16:50:38 +00:00
Janne Valkealahti
a9c52e2a19 Add notes to docs about new annotation model
- Relates #637
2023-03-18 16:40:34 +00:00
Janne Valkealahti
cfd2b7f72e Fix ConfirmationInput template message
- Fix confirmation-input-default.stg to use correct style
  names in format.
- Fixes #690
2023-03-17 08:40:41 +00:00
Janne Valkealahti
0363b38204 Polish 2023-03-13 08:56:42 +00:00
Janne Valkealahti
93f2cf00de Rename name to provider
- Align naming in CommandAvailability
- Relates #663
2023-03-13 08:54:23 +00:00
Simon Verhoeven
60126b9c47 Rename setMaskCharater to setMaskCharacter 2023-03-12 16:08:54 +00:00
Janne Valkealahti
eaa3e5caf9 OptionValues supports multiple resolvers
- Change ref field in OptionValues to providers
  takin an array.
- Relates #637
2023-03-05 16:38:01 +00:00
Janne Valkealahti
d4506d2583 Fix setup-java configs 2023-02-27 17:46:20 +00:00
Janne Valkealahti
c46bf91dae Wrong arity for default boolean type
- Set boolean type arity zero or more as default.
- Fixes #675
2023-02-27 10:12:09 +00:00
Janne Valkealahti
fd73531986 Document @Option long name
- Relates #637
2023-02-24 12:18:16 +00:00
Janne Valkealahti
07e08b36a7 Document registration with @Command
- Split and separate new annotations with legacy annotations
  on a registration level.
- Relates #637
2023-02-24 09:55:26 +00:00
Janne Valkealahti
1170ec965c Upgrade spring-boot 3.1.0-M1
- Fixes #662
2023-02-24 08:54:49 +00:00
Janne Valkealahti
44734fd634 Rename command registration doc files 2023-02-23 09:57:42 +00:00
Janne Valkealahti
9f16ccd57e Polish 2023-02-19 09:32:28 +00:00
Janne Valkealahti
3d3d37294f 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.
- Fixes #667
2023-02-18 14:19:56 +00:00
Janne Valkealahti
cf1a6f7839 Add support defining Availability with annotated method
- This is for new annotation model
- @CommandAvailability which takes names of
  AvailabilityProvider beans supplying Availability info.
- Relates #663
2023-02-09 21:18:22 +00:00
Janne Valkealahti
cb998fae08 Upgrade setup-jfrog-cli action 2023-02-08 17:21:06 +00:00
Janne Valkealahti
8ba7d335b5 Upgrade checkout and setup-java actions 2023-02-08 16:15:58 +00:00
jongwooo
87914b27f5 Replace deprecated command with environment file
Signed-off-by: jongwooo <jongwooo.han@gmail.com>
2023-02-08 16:07:09 +00:00
Janne Valkealahti
75b8a0c90e Rework command parser
- Previously CommandParser contained parser which was
  scannerless type of brute force parsing of command
  line args.
- Contract in that old parser wasn't super clear what
  is its role with caller as it was given options
  and registration was parsed in a Shell class.
- Add completely new parser package which has better
  model and which will be much easier to modify for
  future needs.
- Change some interfaces around parsing so that we do
  as much in this new parsing model instead of pre-parsing
  something in a Shell class.
- We also try to move away from using exceptions as
  a message delivery which had its own problems. Instead
  introducing parser messages which gives better info
  when errors are detected.
- Add ParserConfig class which allows to expose settings
  to change some parser features. Later this will be
  exposed to user so that some features can be turned on/off
  for an actual shell needs.
- Fixes #646
2023-02-08 15:47:08 +00:00
Janne Valkealahti
e8d5d70792 Make annotated command visible to native
- Use @Reflective with @Command
- This should automatically register reflection hints
  and make native work again
- Relates #638
2023-02-08 14:04:42 +00:00
Janne Valkealahti
e721bc57f3 Switch to spring-boot 3.1.0 snapshots
- Relates #662
2023-02-05 17:06:01 +00:00
Janne Valkealahti
006ed5e443 Better e2e tests coverage
- Add integration tests for e2e samples.
- Add some missing commands for new annotation system.
- Fixes #654
2023-02-05 16:21:45 +00:00
Janne Valkealahti
a95e60dd8b Test terminal can set dimensions
- ShellTest now has fields which can be used to
  change terminal default widht/height.
- Backed by properties so can be used with
  `spring.shell.test.terminal-width` and
  `spring.shell.test.terminal-height`.
- Fixes #656
2023-02-05 15:24:36 +00:00
Janne Valkealahti
809e296e55 Handle arg looking options better
- Now lexing better with valid options
- Only report unrecognised option with double dash
  as current parser don't have structure to do
  deeper analysis.
- Fixes #651
2023-02-01 09:29:20 +00:00
Janne Valkealahti
3ce7afac6b CommandRegistration should return same options
- Cache created CommandOption(s) to return same instance.
- Fixes #648
2023-01-28 17:13:29 +00:00
Janne Valkealahti
347b49b262 Update readme 2023-01-28 08:34:52 +00:00
Janne Valkealahti
fcb4f076cd Update readme 2023-01-27 13:00:20 +00:00
Janne Valkealahti
de1a3baf18 New annotation model
- 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
2023-01-27 12:04:21 +00:00
Janne Valkealahti
d1c482cd49 OptionArity NONE value
- Fixes #644
2023-01-27 09:41:03 +00:00
Janne Valkealahti
03b343812d Reorganise e2e samples
- Fixes #642
2023-01-26 14:18:24 +00:00
Janne Valkealahti
2f298ccb6a Define CommandExceptionResolver bean order
- CommandParserExceptionResolver uses default bean
  order -100.
- Fixes #634
2023-01-25 17:57:13 +00:00
Janne Valkealahti
4f50961976 Start next minor development version 2023-01-24 13:42:28 +00:00
github-actions[bot]
bd7f5b882c Next development version 2023-01-24 10:23:23 +00:00
Janne Valkealahti
d44d0c3016 Update next version workflow 2023-01-23 11:32:14 +00:00
Janne Valkealahti
ae3af74b20 Update release workflow 2023-01-23 11:04:07 +00:00
Janne Valkealahti
fb1616e0c6 Polish 2023-01-20 16:09:21 +00:00
Janne Valkealahti
df9c5b5483 Upgrade spring-boot 3.0.2
- Fixes #619
2023-01-20 09:54:24 +00:00
Janne Valkealahti
624343ace2 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.
- Fixes #630
2023-01-19 17:33:18 +00:00
Janne Valkealahti
56b9cb20ef Document String array option type
- Fixes #628
2023-01-19 11:32:37 +00:00
Janne Valkealahti
25d249c28d Exclude ExitRequest from error handling
- Don't try to handle ExitRequest exception with error handling
  so that we're able to break out from a run loop with
  interactive shell.
- Fixes #624
2023-01-18 09:03:03 +00:00
Janne Valkealahti
90010a94ea Fix e2e tests
- As one command name was changed
2023-01-16 21:12:17 +00:00
Janne Valkealahti
6e1ca089d7 Replace parser string joining with list
- 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
2023-01-16 17:47:21 +00:00
Janne Valkealahti
a04091c08f Support modify option names
- 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
2023-01-15 10:02:55 +00:00
Christian Niessner
448c507ce9 Allow Shell.input() to be overridden in subclasses
- the ssh-shell-spring-boot extensions needs to extend to override the Shell.input()
  method to handle the input provided via the SSH session properly
2023-01-13 18:05:35 +00:00