-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Improve Python Fire's tab completion #32
Comments
@dbieber - can you open up read access to everyone? |
Try now |
I like this idea. I left a few thoughts in the doc. Not sure if this has been suggested before but it might make sense to have a "dev" version of the CLI with features like this and be able to ship a prod version with precomputed completions. I can take a stab at implementing this. |
I'm definitely on board with being able to ship a version of a Fire CLI with precomputed completions 👍. I'm not sure I totally understand the distinction you're drawing between "dev" and "prod" though. In "prod" mode, generating new completions would be disabled? Is that the only distinction or are there others? |
Well another could be disabling the --completions flag in "prod". There could also be more verbose errors in "dev" although that would be outside the scope of the completions PR. Do you think it's too much overhead? |
I want to make sure things keep working well in the simple case of:
In particular it would be great if in this case you can get tab completions after having run your CLI only once (or, better, before you even run it at all! This is possible if the completion script runs your CLI with some flag when you hit tab, like your-command -- --get-completions. We'd have to make sure this doesn't execute code the user wasn't intending to execute though.). Once a Fire CLI is shipped with completions, I don't think there's any problem with continuing to update the completions. If all the completions were included, these updates should be a no-op. I suppose I do see value in freezing the completions if there are completions the developer doesn't want to include. One way to freeze completions (akin to your "dev" mode) would be having a config like fire.Fire(freeze_completions=True). Another approach would be to include something in the completions mapping that indicates that it's frozen (haven't thought this last bit through). I'm not sure how necessary completion freezing is, or if it's worth the complexity that it adds. Adding it to the list at #98 though as a possible config to support. |
[As you can see from that list in #98 I've been really reluctant to add configs so far, but at some point we'll probably want to add a number of these. I want to make sure we do so in a way 1) that doesn't make people feel like they're lost in the documentation, 2) that keeps fire working well even for people that don't configure anything, 3) that never necessitates breaking backwards compatibility and that allows future configs to be added to the system seamlessly w/ a good naming convention.] |
That makes sense and I like your point about not getting lost in the docs. |
Brainstorming here: One possibility is having two places to look for completions:
If the first location has completions, only those are used. If not, then PYTHON_FIRE_COMPLETION is used. |
Please see this early stage design document for improving Python Fire's tab completion.
Comments on the design document are welcome!
Contributors also welcome! :)
The text was updated successfully, but these errors were encountered: