Skip to content

Add support for bash completion #343

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jvalkeal opened this issue Jan 2, 2022 · 0 comments · Fixed by #344
Closed

Add support for bash completion #343

jvalkeal opened this issue Jan 2, 2022 · 0 comments · Fixed by #344
Assignees
Milestone

Comments

@jvalkeal
Copy link
Contributor

jvalkeal commented Jan 2, 2022

Once we're starting to get better support for spring-native resulting proper OS level commands it makes a lot of sense to have support to create completion scripts for shells. I've been looking how things are generated from a go side i.e. for bash as some are based on https://github.com/spf13/cobra which have support for bash, zsh, fish and PowerShell.

We could shamelessly copy how actual completion scripts are constructed(as that's the bread and butter) and make that to work with a bit of template magic around https://github.com/antlr/stringtemplate4 which seems to work nicely with native stuff. This all as a result of a quick experiment of making generic completion bash command.

@jvalkeal jvalkeal added this to the 3.0.0-M1 milestone Jan 2, 2022
@jvalkeal jvalkeal self-assigned this Jan 2, 2022
jvalkeal added a commit to jvalkeal/spring-shell that referenced this issue Jan 7, 2022
- 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 spring-projects#343
jvalkeal added a commit that referenced this issue Jan 7, 2022
- 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant