-
-
Notifications
You must be signed in to change notification settings - Fork 54
Add shell completion #23
Add shell completion #23
Conversation
|
||
## generation function | ||
|
||
For a good user experience we don't want to figure out those suggestions on runtime or the completion feature would not be substantially faster then the `ember help` command. So there will be a __generation function__ that generates a JSON file once after ember-cli is installed and then during every `ember install some-addon` command to ensure that blueprints added by new addons are recognized aswell. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you describe the lifetime of this file? Where will it live etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cache key should be described in more detail, ember install
is only run on the installers machine now on there co-workers machines.
It may be interesting to compute a runtime cache key that represents all add-ons and there versions?
My main concern here (as with all caching) is being confident in the invalidation strategy.
I am very +1 on this. There is overlap with: #12 and ember-cli/ember-cli#4576 It seems both depend on a good internal structure to share and to share quickly. cc @kellyselden |
How to cache @stefanpenner Another idea would be to invalidate the file every time you execute an ember command. So while you typing the command, ember-cli is reading from the currently cached file and once you hit enter it spawns a process that will regenerate the file in the background while ember-cli is executing whatever you typed (the generation currently only takes about 1100ms) Or not to cache Regarding the necessity of a cache itself: as i said above, currently the generation takes around 1 second, that is long enough that we do not want to run it every time a user hits The reason i chose this approach is because its very flexible. If you create a blueprint that takes a very powerful DSL as arguments, you could write your custom However if we sacrifice that power and just agree that no command has sub-commands, except for generate, destroy and help. We could hardcode that and speed up the generation quite a bit, maybe making it fast enough to compute on runtime. (blueprints would be gathered and parsed 1 time instead of 4, and commands 1 time instead of 2..) PS: personally, i would rather find a good invalidation technique for a cache instead of that hard coded approach. the current logic will be a lot easier to maintain when ember-cli evolves + i might be emotionally attached to that code :D PPS: Another idea on how to speed up the generation so that we could do it on runtime would be to force the developer to write a dedicated |
small update: i was able to speed up the generation of all those sub commands from 1200ms to 40ms. so there is no need for caching anymore we can just calculate them on the fly |
rad! |
@lazybensch @kellyselden I want to move ahead with both this and ember-cli/ember-cli#4576 There is overlap though, especially when it comes to the schema output. The only thing i know we should do, is to make should the JSON schema remains stable, so outside tooling and continue to rely on it. |
after chatting with @kellyselden we are going to merge #4576 ultimately we need to break the tie somewhere. The goal will be to massage the PR implementing this RFC in. Anyways, I suspect both solutions will benefit from each other. Great work guys! |
@lazybensch I will go through your code and look for places you can use my stuff, and vice versa. |
@stefanpenner i am totally fine with this! As I'm quite new to this project i'll take my time anyway. |
@lazybensch Sounds good! My PR is merged now so it is as final as it's going to be. |
Im very much +1 on this, I will help get the PR to completion. |
Add shell completion
RFC & PR