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

Fix completion for subcommands #126

Merged
merged 1 commit into from
Dec 17, 2020
Merged

Conversation

jrevillard
Copy link
Contributor

fixes #9

This modification make mandatory the bash-completion installation as it depends on __ltrim_colon_completions and _get_comp_words_by_ref.

I removed the embedded __ltrim_colon_completions because _get_comp_words_by_refis too big to be embedded.

@salesforce-cla
Copy link

salesforce-cla bot commented Oct 8, 2020

Thanks for the contribution! Before we can merge this, we need @jrevillard to sign the Salesforce.com Contributor License Agreement.

@G-Rath
Copy link
Contributor

G-Rath commented Dec 7, 2020

@RasPhilCo anything I can do to help get this landed? It'd be a great improvement to have for the heroku cli :)

@RasPhilCo
Copy link
Contributor

@G-Rath have you tested it out? PR looks good but I don't have time to do a full implementation before the holidays but trust your testing.

@G-Rath
Copy link
Contributor

G-Rath commented Dec 17, 2020

@RasPhilCo applying it to heroku.bash - it seems to work fine and as I'd expect:

image

I've not used a lot of the commands to the point of knowing them in enough detail to easy check they've all got their flags and the behaviours are working, but feel free to give me a list of situations you'd like me to try out if you have anything you'd like tested :)

One thing of note is that the heroku autocomplete file seems to be custom - it's got analytics & sources commands from a file in $HEROKU_AC_COMMANDS_PATH - I had to add this to get it working:

local commands="$(cat $HEROKU_AC_COMMANDS_PATH)"

@G-Rath
Copy link
Contributor

G-Rath commented Dec 17, 2020

Oh but it does seem that for suggestions after : it lists just the subcommands, which can look a little confusing:

image

i.e in the above for pg, it's actually suggesting pg:backup, pg:restore, etc.

I think this is good enough to ship, but might be worth a follow-up issue to improve it if possible.

@G-Rath
Copy link
Contributor

G-Rath commented Dec 17, 2020

Can confirm it works for sub-sub-commands 🎉

image

@RasPhilCo
Copy link
Contributor

@jrevillard @G-Rath Great, thanks! And have a nice holiday!

@RasPhilCo RasPhilCo merged commit 30b2857 into oclif:master Dec 17, 2020
@jrevillard jrevillard deleted the patch-2 branch December 17, 2020 19:54
@jrevillard
Copy link
Contributor Author

jrevillard commented Dec 17, 2020

Great, thanks @RasPhilCo @G-Rath!

@G-Rath
Copy link
Contributor

G-Rath commented Dec 17, 2020

@RasPhilCo cheers, you too!

@jrevillard thanks for this!

oclif-bot added a commit that referenced this pull request Dec 17, 2020
# [0.3.0](v0.2.1...v0.3.0) (2020-12-17)

### Bug Fixes

* completion for subcommands ([#126](#126)) ([30b2857](30b2857)), closes [#9](https://github.com/oclif/issues/9)
* **zsh:** update zsh autocomplete to work with default settings ([#92](#92)) ([b9e8e7b](b9e8e7b)), closes [#91](#91)

### Features

* install on windows bash ([#34](#34)) ([4ca20e5](4ca20e5))
@oclif-bot
Copy link
Contributor

🎉 This PR is included in version 0.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@RodEsp
Copy link
Contributor

RodEsp commented Dec 7, 2021

@RasPhilCo @G-Rath @jrevillard why was __ltrim_colon_completions() removed here if it is still being used?

As far as I can tell this makes autocompletion for any oclif CLI dependent on the user installing bash-completion but I don't see that anywhere in oclif repos or documentation. Am I missing something?

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.

Completion does not work for sub-commands
5 participants