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

Use recipes for bash shell completions. #685

Merged
merged 8 commits into from
Oct 6, 2020

Conversation

vikesh-raj
Copy link
Contributor

Use just --list command to get the available recipes and use that to complete the command.

Use just --list command to get the available recipes and use that
to complete the command.
@casey
Copy link
Owner

casey commented Oct 1, 2020

Thank you for this! --list includes doc comments and arguments, in addition to the recipe's name. Should --summary be used instead?

@vikesh-raj
Copy link
Contributor Author

I don't have rust environment or zsh for running tests.
I like this program a lot. I sometimes forget the recipe name. This tab complete feature helps in listing the recipes and completing them.

@casey
Copy link
Owner

casey commented Oct 2, 2020

Glad you like it, and no worries!

The reason the tests are failing is a bit convoluted. The completion scripts are generated automatically using clap, an command line argument parser. But, the generated scripts don't include the ability to complete recipes, since clap only knows about flags and options. So, I wrote a rust program that makes modifications to the completion scripts to include recipe completion.

The test that's failing checks that the generated completion script is the same as what's checked in, which is why it's failing.

I'm happy to merge the changes in to the script, I should be able to do it tomorrow.

@casey
Copy link
Owner

casey commented Oct 3, 2020

I modified the script, so the tests should pass now. (You can ignore the error, it's spurious.) However, there's a problem, with the modifications, the bash completion script won't complete flags and options, so for example, the following don't work:

$ just <TAB>
$ just -<TAB>

@vikesh-raj
Copy link
Contributor Author

@casey , I have now modified the the subcommand.rs file to replace a bigger portion.
just -TAB , now completes the options
just TAB, completes the recipes.
This is the same behaviour for make command.

@casey casey merged commit a836101 into casey:master Oct 6, 2020
@casey
Copy link
Owner

casey commented Oct 6, 2020

Awesome, merged! Thank you very much for the pull request!

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 this pull request may close these issues.

None yet

2 participants