Skip to content
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

Generate a bash_completion file on run #7

Open
twof opened this issue Dec 2, 2017 · 6 comments
Open

Generate a bash_completion file on run #7

twof opened this issue Dec 2, 2017 · 6 comments

Comments

@twof
Copy link
Owner

twof commented Dec 2, 2017

I think that's what's happening here:
https://github.com/apple/swift-package-manager/blob/master/Sources/Commands/Completions%2Bbash.swift

@twof
Copy link
Owner Author

twof commented Dec 12, 2017

Another example implementation:
vapor/vapor#1347

@joscdk
Copy link

joscdk commented Dec 13, 2017

@twof the idea in #1347 is when you build a CLI e.g. Toolbox, you can include our template completion for bash and zsh in e.g. Homebrew.

The PR adds a --autocomplete so the completion real time gets all available commands from the CLI script, a bit different from what SPM file does :)

@twof
Copy link
Owner Author

twof commented Dec 14, 2017

So if I'm understanding correctly, SPM has a static bash_completion file, and vapor gets a list of the commands available and generates it on the fly?

@joscdk
Copy link

joscdk commented Dec 14, 2017

More or less. With the PR in Vapor, you will need to have the bash_completion file on your Mac/Linux .. This file will load available commands from the CLI script.

E.g. In the toolbox, it will automatically download and setup the autocompletion file on your computer in Homebrew/APT

We will also provide examples of bash completion files for people building their own CLI scripts :) .. This way it's easy to customize the bash completion file for your script if you want :)

Later we will also provide examples for zsh completion :)

@twof
Copy link
Owner Author

twof commented Dec 14, 2017

Awesome! Thanks for the explanation

@joscdk
Copy link

joscdk commented Dec 14, 2017

No problem :) .. Thought that would be the most flexible solution, and still keep loyal to the *nix system :) and have a really easy setup/maintenance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants