Commit Graph

39 Commits

Author SHA1 Message Date
Janne Valkealahti
52ff4a2d85 Add version command
- Add new styling system which works around concept that
  you use tags to request jline styles where tags comes
  from an activated theme.
- There is a default theme with options to add custom
  ones and change it via property.
- Add templating system which uses antlr stringtemplate which
  allows to write output with a template instead of manually
  crafting code.
- Add version command which integrates to Boot's BuildProperties
  and GitProperties. Only version field is visible on default
  and others can be enabled/disable via properties.
- Fixes #352
- Fixes #353
2022-01-23 09:23:16 +00:00
Janne Valkealahti
668ddb458e Completion command for bash
- Add basic support of defining a command `completion bash` which
  outputs a generic bash script which can be used in a user environment.
- Idea for completion is copied from go's cobra library what comes for
  a bash dance itself.
- Goes through command registry, builds a model for command structure
  and uses antlr st4 for templating bash.
- Should give foundation to create other completions just like in cobra.
- Currently as we don't know a root-command in a generic way, option
  `spring.shell.command.completion.root-command` is required user to set.
- Fixes #343
2022-01-07 10:02:51 +00:00
Janne Valkealahti
7298b2ce78 Support for non-interactive shell commands
- Add support for running shell commands as a non-interactive mode.
- This works by adding new ShellApplicationRunner interface which is
  an extension to ApplicationRunner forcing to have exactly one main
  ApplicationRunner and then DefaultApplicationRunner dispatches to
  new interface ShellRunner which allows to pick between script,
  interactive and non-interactive, etc.
- It is sort of a breaking change but works much better not having
  a need to have previous hooks between application runners to disable
  things at runtime.
- All this makes it closer for a user to have a choice between
  using shell commands as is without entering interactive mode.
- Also add SpringShellProperties for better config props support
  for boot users.
- Fixes #342
2021-12-31 15:30:52 +00:00
Janne Valkealahti
7042d1f83b Rework shellConversionService
- Replace old ConversionService impl with something more aligned
  with current boot code with partially shameless copy as
  shell is most likely working outside of web or webflux env
  by creating FormattingConversionService and hooking convertes
  from DefaultConversionService.
- This should work on most cases and giving user a hook
  to define their own service.
2021-12-24 15:04:40 +00:00
Janne Valkealahti
54702460d1 Make sample to work with spring-native
- While project uses jdk8, you can do native build with jdk11
  `./mvnw clean package -Pnative`
- You can then run these
  spring-shell-samples/target/spring-shell-samples
  java -jar spring-shell-samples/target/spring-shell-samples-3.0.0-SNAPSHOT-exec.jar
- Remove logback.xml in favour of spring config to workaround for
  https://github.com/spring-projects-experimental/spring-native/issues/625
- For now remove jcommander command sample to get support for it #340
- Relates #323
2021-12-24 13:27:44 +00:00
Janne Valkealahti
f6394a4531 Rework bean handling
- Lot of rework to move better model to work around bean cycles
- Remove use of @Lazy
- Move StandardAPIAutoConfiguration to autoconfig package
- Remove some of a direct ObjectProvider use in constructors
- Adds spring-native support with most of a things working out of a box
- Relates #324
- Relates #329
- Relates #323
2021-12-24 08:50:40 +00:00
Janne Valkealahti
5dcdc4c185 Extract autoconfig
- Create separate spring-shell-autoconfigure and keep
  all autoconfig features there.
- Fixes #329
2021-12-19 12:38:41 +00:00
Janne Valkealahti
af838ca006 Polish 2021-12-18 16:59:48 +00:00
Janne Valkealahti
a8d20f29bf Remove legacy from sample
- Preparation for further work as remove shell 1.x dep
  from sample.
- Relates #333
2021-12-18 14:47:34 +00:00
Janne Valkealahti
e14f4a3f32 Remove bean cycles
- Shuffle things around into different auto-config and configuration
  classes and use other tricks like ObjectProvider to work around
  boot 2.6.x imposing bean cycle checks.
- This is first set of changes to work around this issue, not
  to make things perfect. Further refactoring work is needed
  making code base more boot 2.x friendly as things are based
  on boot 1.5.x times.
- Fixes #324
2021-12-17 15:32:52 +00:00
Janne Valkealahti
90216bdc32 Switch from BUILD-SNAPSHOT to SNAPSHOT 2021-12-17 14:25:52 +00:00
Janne Valkealahti
5e61ff1315 Polish unused imports 2021-12-11 13:09:00 +00:00
Janne Valkealahti
e30edf2446 Update boot 2.6.1
- Migrate tests to junit5 and assertj as those
  are on a classpath automatically.
- Temporarily use spring.main.allow-circular-references=true
  to allow time for fixes to remove cycles.
2021-12-11 12:57:34 +00:00
Spring Operator
23d99f45eb URL Cleanup
This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener).

# HTTP URLs that Could Not Be Fixed
These URLs were unable to be fixed. Please review them to see if they can be manually resolved.

* http://jcommander.org/apidocs/ (200) with 1 occurrences could not be migrated:
   ([https](https://jcommander.org/apidocs/) result SSLHandshakeException).

# Fixed URLs

## Fixed Success
These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended.

* http://docs.spring.io/spring-framework/docs/current/javadoc-api/ with 1 occurrences migrated to:
  https://docs.spring.io/spring-framework/docs/current/javadoc-api/ ([https](https://docs.spring.io/spring-framework/docs/current/javadoc-api/) result 200).
* http://maven.apache.org/xsd/assembly-2.0.0.xsd with 1 occurrences migrated to:
  https://maven.apache.org/xsd/assembly-2.0.0.xsd ([https](https://maven.apache.org/xsd/assembly-2.0.0.xsd) result 200).
* http://maven.apache.org/xsd/maven-4.0.0.xsd with 12 occurrences migrated to:
  https://maven.apache.org/xsd/maven-4.0.0.xsd ([https](https://maven.apache.org/xsd/maven-4.0.0.xsd) result 200).
* http://repo.spring.io/libs-milestone-local with 2 occurrences migrated to:
  https://repo.spring.io/libs-milestone-local ([https](https://repo.spring.io/libs-milestone-local) result 302).
* http://repo.spring.io/libs-snapshot-local with 2 occurrences migrated to:
  https://repo.spring.io/libs-snapshot-local ([https](https://repo.spring.io/libs-snapshot-local) result 302).
* http://repo.spring.io/release with 1 occurrences migrated to:
  https://repo.spring.io/release ([https](https://repo.spring.io/release) result 302).

# Ignored
These URLs were intentionally ignored.

* http://maven.apache.org/ASSEMBLY/2.0.0 with 2 occurrences
* http://maven.apache.org/POM/4.0.0 with 24 occurrences
* http://www.w3.org/2001/XMLSchema-instance with 13 occurrences
2019-03-26 11:55:46 +01:00
Spring Operator
2ccab80189 URL Cleanup
This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener).

# Fixed URLs

## Fixed Success
These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended.

* [ ] http://www.apache.org/licenses/ with 1 occurrences migrated to:
  https://www.apache.org/licenses/ ([https](https://www.apache.org/licenses/) result 200).
* [ ] http://www.apache.org/licenses/LICENSE-2.0 with 125 occurrences migrated to:
  https://www.apache.org/licenses/LICENSE-2.0 ([https](https://www.apache.org/licenses/LICENSE-2.0) result 200).
2019-03-26 11:48:12 +01:00
Janne Valkealahti
31c7462ee3 Change to boot 2.x
- disable PropertyPlaceholderAutoConfiguration in NoAutoConf
- Remove shell1 deps
- Update README
2018-11-14 12:16:30 +00:00
Janne Valkealahti
4f0dc203af Change to next major development version 3.0.0 2018-11-14 09:11:34 +00:00
Eric Bottard
c3081d260e Bump samples version 2018-04-25 10:41:07 +02:00
Eric Bottard
ea71c3821b Fix capturing CTRL-C to exit the shell.
Fixes #195
2018-01-18 09:40:32 +01:00
Eric Bottard
f90edd42c4 Make ResultHandlers configuration more explicit
Handle exit as a dedicated case (prevents eg 'exit' commands in scripts to make script quit)
Add an example of custom ApplicationRunner

Fixes #187
Fixes #183

Decouple ApplicationRunners

Make ThrowableResultHandler behave differently in non-interactive mode
2018-01-15 15:59:01 +01:00
Eric Bottard
bdeea83d8b Cleanup samples 2017-10-16 14:31:07 +02:00
Eric Bottard
c86b813fed Fix Typo 2017-10-04 11:17:01 +02:00
Eric Bottard
32c65f2da7 Allow usage without Spring Boot AutoConfiguration
Fixes #166
2017-10-04 11:15:01 +02:00
Eric Bottard
531dc35abe Add a group to a couple sample classes 2017-09-25 14:46:10 +02:00
Eric Bottard
a50b741af1 Document PromptProvider, ApplicationRunner and ConversionService.
Make the default ConversionService register converters in the ctx
2017-09-19 13:57:28 +02:00
Eric Bottard
8f3c11a3bd Move logback configuration out of core 2017-09-11 16:54:53 +02:00
Eric Bottard
32c18bec75 Document bean validation constraints in help()
Fixes #147
2017-09-08 16:38:42 +02:00
Eric Bottard
c8ab5f1698 Implement completion for legacy provider
Fixes #149
2017-09-08 10:16:38 +02:00
Eric Bottard
3b0901af17 Pretty print bean validation errors
Fixes #137
2017-08-30 21:59:53 +02:00
Eric Bottard
9f88c03cf3 Add ability to run commands and exit 2017-08-30 16:54:36 +02:00
Eric Bottard
e38205b2b2 Add ASCII Table support
Fixes #136
2017-08-28 19:00:36 +02:00
Eric Bottard
1eea04ad2f Add dynamic command availability
Introduce availability concept on MethodTarget (with reason if not available)
Add bridge to @CliAvailabilityIndicator to Legacy registrar

Fixes #138

Add help for unavailable commands

Add standard API for availability
2017-08-23 18:44:31 +02:00
Eric Bottard
5b07a1a89c Rename ShellMethod.help() to value(), as it is the only mandatory attribute. 2017-08-10 11:13:13 +02:00
Eric Bottard
c98642c2f7 Add starter, make adapter kick in only if needed 2017-08-08 17:18:20 +02:00
Eric Bottard
c3c7f1fccd Add PromptProvider extension point 2017-08-08 16:07:12 +02:00
Eric Bottard
75911b5fed Add some docs 2017-08-08 11:52:32 +02:00
Eric Bottard
0ca3dacdce Allow overrides of standard commands 2017-08-08 11:52:32 +02:00
Eric Bottard
c8e4752119 Prevent double registration of commands 2017-08-08 11:52:32 +02:00
Eric Bottard
6497df181d Refactor packages and artifactIds to prepare for official migration to spring-projects repo.
Remove usage of component scan in favor of auto-conf

Fixes #61
2017-08-08 11:52:32 +02:00