Commit Graph

650 Commits

Author SHA1 Message Date
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
b853112e0b 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.
- Backport #622
- Fixes #623
2023-01-16 21:03:47 +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
c1604021c6 Use nexus-sync 0.0.x 2023-01-10 13:01:58 +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
Janne Valkealahti
800e249b98 Fix NPE
- Backport #593
- Fixes #598
2023-01-01 15:12:48 +00:00
Janne Valkealahti
dd84beafcb Upgrade spring-boot 2.7.7
- Fixes #595
2022-12-27 15:56:31 +00:00
guang384
7a6d457e71 Wraps ExtendedArgumentList into CompletingParsedLine prevent WARNING during startup.
- Idea/hack copied from jline LineReaderImpl
- Backport #526
- Fixes #594
2022-12-27 15:34:41 +00:00
github-actions[bot]
14aa6f1703 Next development version 2022-12-01 16:10:00 +00:00
Janne Valkealahti
e70ea6b555 Register option without prefix
- While option should be defined i.e. using "--arg", discover
  prefix from ShellMethod#prefix and use that if just "arg"
  is defined.
- Backport #575
- Fixes #577
2022-11-26 15:09:25 +00:00
Janne Valkealahti
7e2c6c180a Upgrade spring-boot 2.7.5
- Fixes #571
2022-11-25 15:12:47 +00:00
Janne Valkealahti
df19da0dde Method execution should not error without value
- Do npe check when getting class type out from
  incoming value.
- Backport #572
- Fix #573
2022-11-22 07:53:48 +00:00
Janne Valkealahti
bc0b4a13df Re-quote whitespace
- 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.
- Backport #567
- Fixes #570
2022-11-18 07:28:07 +00:00
github-actions[bot]
3e5eac7008 Next development version 2022-10-24 06:52:51 +00:00
Janne Valkealahti
b220ea5656 Use nexus-sync main 2022-10-24 07:31:45 +01:00
Janne Valkealahti
a7d53d4226 Upgrade spring-boot 2.7.5
- Fixes #547
2022-10-21 13:52:53 +01: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
1b47df4b2e Fix correct snapshot version 2022-10-04 11:55:44 +01:00
Janne Valkealahti
e90929cadc Fix correct branch refs in workflows 2022-10-03 11:34:56 +01:00
Janne Valkealahti
d47d23f930 Upgrade spring-boot 2.7.4
- Fixes #538
2022-09-23 16:28:00 +01:00
Janne Valkealahti
2cf712328c Fix next handling in ComponentFlow
- This fixes a bug where returning null from a next()
  didn't stop a flow.
- Backport #510
- Fixes #513

(cherry picked from commit 7c4700b7b5)
2022-08-22 16:30:52 +01:00
Janne Valkealahti
9087692999 Next development version 2022-08-19 14:39:33 +01:00
Janne Valkealahti
43ad2d7059 Upgrade spring-boot 2.7.3
- Fixes #500
2022-08-18 10:33:29 +01:00
Janne Valkealahti
225f3e9f71 Polish javadocs
(cherry picked from commit eb82af42ed)
2022-08-18 08:34:58 +01:00
Janne Valkealahti
6e007fbf5f Split builtin command docs
- Fixes #505
- Backport #504

(cherry picked from commit 57b9259701)
2022-08-17 17:40:17 +01:00
Janne Valkealahti
608b94ddfd Polish
- Backport main

(cherry picked from commit 891e1e17ef)
2022-08-16 15:10:41 +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
Thibaut Gautier
703ffc8ec6 Fix ShellMethod not using context validator
(cherry picked from commit 23194d05e2)

- Backport #493
- Fixes #496
2022-08-02 09:57:16 +01:00
Janne Valkealahti
f826f29d77 Next development version 2022-07-23 15:15:17 +01:00
Janne Valkealahti
000ff981da Add pom fields required by central 2022-07-23 14:57:42 +01:00
Janne Valkealahti
dc4dab82f3 Polish release notes template 2022-07-23 07:38:13 +01:00
Janne Valkealahti
690d1d2e62 Add commands as list in help templating
- Add getNames method.
- Add docs for templating info and fields to help.
- Fixes #480
2022-07-21 21:24:41 +01:00
Janne Valkealahti
416700b10b Upgrade to Spring Boot 2.7.2
- Fixes #477
2022-07-21 14:09:36 +01:00
Janne Valkealahti
153f9e70a2 Fix tests
- Take2
- Relates to changes in #476
2022-07-20 10:10:58 +01:00
Janne Valkealahti
0fd67f2fad Fix tests
- Relates to changes in #476
2022-07-20 09:29:32 +01:00
Janne Valkealahti
d81e2614e3 Fix styling issue
- 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
2022-07-20 09:01:05 +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
329c7eb559 Add central sync to ga workflow
- Relates #454
2022-07-19 17:14:54 +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
5ba8e185bc Fix method argument without ShellOption
- 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
2022-07-14 20:21:52 +01:00
Janne Valkealahti
c9cea37cf0 Add ga release workflow
- Fixes #454
2022-07-14 17:27:07 +01:00
Leszek Jasek
0edc9ada38 Fix typos in using-shell-options-optional.adoc 2022-07-14 19:18:50 +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
d88849dfa9 Separate commit and push in release workflow
- Fixes #452
2022-07-07 08:53:10 +01:00
Janne Valkealahti
932e9d5d75 Update docs
- Completion docs
- Relates #433
2022-07-07 08:09:23 +01:00
Janne Valkealahti
03a02a0615 Flatten docs structure
- Essentially remove "Using Spring Shell" and move
  its content one level up.
- Fixes #433
2022-07-06 09:36:36 +01:00