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
This commit is contained in:
Janne Valkealahti
2022-01-07 09:58:21 +00:00
parent 7298b2ce78
commit 668ddb458e
17 changed files with 1408 additions and 22 deletions

View File

@@ -24,6 +24,7 @@
<properties>
<jline.version>3.21.0</jline.version>
<jcommander.version>1.81</jcommander.version>
<antlr-st4.version>4.3.1</antlr-st4.version>
</properties>
<modules>
@@ -98,6 +99,11 @@
<version>${jcommander.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>ST4</artifactId>
<version>${antlr-st4.version}</version>
</dependency>
</dependencies>
</dependencyManagement>