[BUG] Version 3.0 broke shell completion and is less readable
Opened this issue · 10 comments
Before creating a bug report please make check the following
- You have read our FAQ
- If you have used flutter. Please install correctly, run
pub cache repair
. Close the terminal and try again. - If you are on Windows. Make sure you are running the terminal as
administrator
or withdeveloper
permissions. - Run
fvm doctor
if possible and add the output to the issue.
Describe the bug
I noticed that fvm
changed its UI a lot in v3. Now there are borders around everything. I understand some may like it, but I really don't – I wish there was a way to disable it, or that an earlier UI could be restore without impacting functionality.
fvm list - before
$ fvm list
Cache Directory: /Users/bartek/fvm/versions
master
3.19.0 (global)
fvm list - after
$ fvm list
Cache directory: /Users/bartek/fvm/versions
┌─────────┬─────────┬────────────────────┬─────────────────┬──────────────┬────────┐
│ Version │ Channel │ Flutter Version │ Dart Version │ Release Date │ Global │
├─────────┼─────────┼────────────────────┼─────────────────┼──────────────┼────────┤
│ master │ │ 3.20.0-13.0.pre.30 │ 3.4.0-175.0.dev │ │ │
├─────────┼─────────┼────────────────────┼─────────────────┼──────────────┼────────┤
│ 3.19.0 │ stable │ 3.19.0 │ 3.3.0 │ Feb 15, 2024 │ ● │
└─────────┴─────────┴────────────────────┴─────────────────┴──────────────┴────────┘
I prefer the first UI style much more - it's simpler, takes less space, and is easier to parse. I appreciate however more information provided by the second UI style.
But what's worse is that fvm v3 broke the unofficial Zsh shell completion script (source).
It used to work great, like this (example of fvm install <TAB>
):
Screen.Recording.2024-03-11.at.01.34.19.mov
but now it breaks, likely because of the addition of colored borders:
bug.mov
To Reproduce
Use TAB shell completion on fvm v3. For example, try $ fvm install <TAB>
and notice how it breaks.
Expected behavior
- I want to be able to go back to the old v2 UI. Additional option in
.fvmrc
would be great. - I expect shell completion to work as before.
Desktop
- OS: macOS 14 Sonoma
- FVM Version: 3.0.13
Additional context
I very much appreciate the awesome work you're doing with fvm
- thank you. I am willing to help contribute this if you agree.
I created PR #690, which should help with this in some cases, but it seems that the completion you referenced will have to be updated for version 3.0.
I am working on an API command to provide clean JSON outputs for actions like listing releases and projects. However, I am not sure if this will be helpful. I would like to make the completions compatible with 3.0 without completely changing the output. I am unsure if this is possible.
Thanks, but unfortunately PR #690 is not exactly what I want. I personally am not a fan of the cli_completion
package because of VeryGoodOpenSource/cli_completion#64 and VeryGoodOpenSource/cli_completion#58.
I am working on an API command to provide clean JSON outputs for actions like listing releases and projects. However, I am not sure if this will be helpful.
I think it will, but as you said, it will require (more) work to make the completion script work again.
Also, if I may ask, what was the rationale for adding the colored boxes and stuff to output?
Actually I think we can make shell completion work when you integrate cli_completion
package into fvm
. I did a small investigation and writeup -> see VeryGoodOpenSource/cli_completion#90
I'm happy to help with making it work once you merge PR #690
I went ahead and merged it. Also, I am working on a JSON API for fvm to return clean JSON for specific commands.
So I investigated a bit and looks like it's not as simple as I thought.
The main problem is that the cli_completion
package doesn't let us control completion suggestions. I created an issue to track this: VeryGoodOpenSource/cli_completion#91.
I am working on an API command to provide clean JSON outputs for actions like listing releases and projects.
This would imply that the completions will be able to parse that JSON. I think the easiest solution is to add a plaintext mode to commands that output some data (e.g. fvm releases
), in addition (or instead of) JSON outputs. This way the existing completions would start working again with minor modification.
@bartekpacia do you think the JSON api resolves this problem?
It's a step in the right direction but outputting JSON means that the completion script must be able to parse that json, thus requiring jq
, which is undesirable.
Plain text is the universal interface of the command line.
@bartekpacia I agree, the main goal is to provide an interface that can be maintained. As the logging and output can sometimes change. We can create a flag to return not as json, but as plaintext, let me know what formatting would work for you.
@bartekpacia if this is something you would like to reopen and help me thorugh it can you create another issue or open a PR, but will close this issue
Hey, sure, it's on my (long) backlog and I hope to improve this.
But why close the issue then?