Skip to content

Commit 5ae109b

Browse files
committed
docs: update README
1 parent a7c5d1d commit 5ae109b

1 file changed

Lines changed: 14 additions & 94 deletions

File tree

README.md

Lines changed: 14 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1-
# cloud-spring
1+
<div align="center">
2+
<img src="https://github.com/Incendo/cloud/raw/master/img/CloudNew.png" width="300px"/>
3+
<br/>
4+
<h1>cloud-spring</h1>
5+
6+
![license](https://img.shields.io/github/license/incendo/cloud.svg)
7+
[![central](https://img.shields.io/maven-central/v/org.incendo/cloud-spring)](https://search.maven.org/search?q=org.incendo)
8+
![build](https://img.shields.io/github/actions/workflow/status/incendo/cloud-spring/build.yml?logo=github)
9+
[![docs](https://img.shields.io/readthedocs/incendocloud?logo=readthedocs)](https://cloud.incendo.org)
10+
</div>
211

312
This is an opinionated implementation of [Cloud](https://github.com/incendo/cloud) for
413
[Spring Shell](https://spring.io/projects/spring-shell).
@@ -36,96 +45,7 @@ The example module contains a Spring Boot application with a couple of commands.
3645

3746
- no intermediate executors (you can do `/cat add` and `/cat remove` but not `/cat`)
3847

39-
## usage
40-
41-
**cloud-spring is not yet available on Maven Central!**
42-
```xml
43-
<dependencies>
44-
<dependency>
45-
<groupId>cloud.commandframework</groupId>
46-
<artifactId>cloud-spring</artifactId>
47-
<version>1.0.0</version>
48-
</dependency>
49-
</dependencies>
50-
```
51-
52-
You should first familiarize yourself with the [Cloud Docs](https://cloud.incendo.org).
53-
The easiest way to use the `SpringCommandManager` is by using `SpringCommandSender` as the command sender type,
54-
because there are default bindings set up for this.
55-
If you want to use a custom command sender type then you'll want to create a binding for `CommandSenderSupplier`:
56-
```java
57-
@Bean
58-
@NonNull CommandSenderSupplier<YourSenderType> commandSenderMapper() {
59-
return () -> yourSender;
60-
}
61-
```
62-
Cloud will create an instance of `SpringCommandManager` which automatically register commands to Spring Shell.
63-
64-
The recommended way of creating commands is by extending `CommandBean`.
65-
Command beans are automatically registered to the command manager.
66-
Examples can be found
67-
[here](https://github.com/Incendo/cloud-spring/tree/main/example/src/main/java/org/incendo/cloud/spring/example/commands).
68-
69-
You may also autowire the `SpringCommandManager` and manually register commands.
70-
71-
### command execution coordinator
72-
73-
The command execution coordinator can be customized by creating a binding for `SpringCommandExecutionCoordinatorResolver`.
74-
By default, `CommandExecutionCoordinator.simpleCoordinator` will be used.
75-
76-
### annotated commands
77-
78-
If you want to use annotated commands, then you must create a binding for `AnnotationParser`.
79-
When doing so, you also have the option of creating a builder modifier that targets the `@CommandGroup` annotation:
80-
```java
81-
@Bean
82-
@NonNull AnnotationParser<YourSenderType> annotationParser(
83-
final @NonNull SpringCommandManager<YourSenderType> commandManager
84-
) {
85-
final AnnotationParser<YourSenderType> annotationParser = new AnnotationParser<>(
86-
commandManager,
87-
YourSenderType.class
88-
);
89-
// Optional: Binding for `@CommandGroup`
90-
annotationParser.registerBuilderModifier(CommandGroup.class,
91-
(annotation, builder) -> builder.meta(SpringCommandManager.COMMAND_GROUP_KEY, annotation.value()));
92-
return annotationParser;
93-
}
94-
```
95-
96-
Cloud will then automatically detect all beans annotated with `@ScanCommands` and register them to `AnnotationParser`:
97-
```java
98-
@ScanCommands
99-
@Component
100-
public class SomeCommand {
101-
102-
@CommandGroup("A group")
103-
@CommandDescription("A description")
104-
@CommandMethod("A command")
105-
public void yourCommand() {
106-
// ...
107-
}
108-
}
109-
```
110-
111-
Spring beans can be injected into command methods. You may annotated the injected members with `@Qualifier`:
112-
```java
113-
@CommandMethod("command <argument>")
114-
public void yourCommand(
115-
@Argument String argument,
116-
@Qualifier("bean") SomeBean someBean
117-
) {
118-
// ...
119-
}
120-
```
121-
122-
### completions
123-
124-
Cloud suggestions will be invoked to provide suggestions for your commands.
125-
You can use normal suggestions, but we also offer `CloudCompletionProposal` which
126-
allows you to use rich completions:
127-
```java
128-
CloudCompletionProposal.of("proposal")
129-
.displayName("with a display name")
130-
.category("and a category");
131-
```
48+
## links
49+
50+
- Docs: https://cloud.incendo.org/spring/
51+
- Incendo Discord: https://discord.gg/aykZu32

0 commit comments

Comments
 (0)