A command line framework based on Java/SpringBoot enables your application to have the same function as spark shell.
English version goes here.
- SpringBoot project only relies:
<!-- https://mvnrepository.com/artifact/com.wl4g/dopaas-shell-springboot -->
<dependency>
<groupId>com.wl4g</groupId>
<artifactId>dopaas-shell-springboot</artifactId>
<version>${latest.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.wl4g/dopaas-shell-cli -->
<dependency>
<groupId>com.wl4g</groupId>
<artifactId>dopaas-shell-cli</artifactId>
<version>${latest.version}</version>
</dependency>
- Java project only relies:
<!-- https://mvnrepository.com/artifact/com.wl4g/dopaas-shell-core -->
<dependency>
<groupId>com.wl4g</groupId>
<artifactId>dopaas-shell-core</artifactId>
<version>${latest.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.wl4g/dopaas-shell-cli -->
<dependency>
<groupId>com.wl4g</groupId>
<artifactId>dopaas-shell-cli</artifactId>
<version>${latest.version}</version>
</dependency>
cd dopaas-shell
mvn clean install -DskipTests -T 2C
Specify the port of the service, and then run as a client (applicable to the client mode, usually temporarily used to connect to the application service):
java -Dservpoint=127.0.0.1:60103 -Dprompt=my-shell -Dtimeout=5000 -jar dopaas-shell-cli-${version}-executable.jar
In the command above -dservpoint represents the service listening address and port to connect to.
Specify the name of the service and run it directly as a client (for local mode, usually as a built-in console for application services):
java -Dservname=shell-example -Dprompt=my-shell -Dtimeout=5000 -jar dopaas-shell-cli-${version}-executable.jar
In the above command, the -Dservname
indicates the application name of the server(spring.application.name
is used by default for springboot application). It will be automatically checked locally according to servname Find the service port to establish a connection (pay attention to case). You can also use Mode1 to display the specified service endpoint with -dservpoint, where -Dprompt
is used to set up the shell
Command line prompt of console, -Dtimeout
specifies the timeout time for waiting results to return (default: 180_000
ms), and can also print debugging information using -Dxdebug
.
Before you can test the sample command, you must run the example server first: com.wl4g.ShellExample
3. Support common shortcut keys, such as tab automatic completion, Ctrl ++A cursor jump to the beginning of line, Ctrl+E cursor jump to the end of line, and Ctrl+C exit console (follow GNU)
7. Support concurrency control lock (Source refer: ShellMethod#lock())
long-opt | short-opt | Description |
---|---|---|
clear | cls | Cleanup console |
exit/quit | ex/qu | Exting console |
history | his | Show history commands (Default save to: $USER_HOME/.wl4g/shell/history) |
stacktrace | st | Show last error stacktrace information |
help | he | Show help usage information |
login | lo | Request login(for example, When spring.shell.dopaas.shell.acl.enabled=true , all command execution must log in, otherwise there is no need to login.) |