Open UncleGravity opened 4 months ago
@fredricocalamari can help here? He did the zsh stuff :)
@fredricocalamari can help here? He did the zsh stuff :)
I'm here. I'll take a look into it. I have different dynamic completions for distrobox that I created about 8 months ago here: https://github.com/fredricocalamari/zsh-completions/tree/master/distrobox
After experimenting with dynamic completions, I tried submitting a merge request, but I encountered some unexpected issues that I found after submitting it for review. I rewrote them with different logic, a few times, and ended up with the ones linked above. I am sure they mostly solid, although I don't have people to test them.
Describe the bug Running
distrobox-enter <TAB>
doesn't show the correct completion in zsh. It works correctly in bash. I think the zsh completions have a bug so I fixed it in my local machine and now completions work correctly. I don't know if this is a "shippable" fix but I wanted to share here.#compdef distrobox-enter _distrobox_containers() { local -a containers containers=(${(f)"$(distrobox list --no-color | tail -n +2 | cut -d'|' -f2 | tr -d ' ')"}) _describe 'container name' containers } _arguments \ '(--name -n)'{-n,--name}'[name for the distrobox]:container name:_distrobox_containers' \ '(--root -r)'{-r,--root}'[launch podman/docker/lilipod with root privileges]' \ '(--help -h)'{-h,--help}'[show this message]' \ '(--verbose -v)'{-v,--verbose}'[show more verbosity]' \ '(--version -V)'{-V,--version}'[show version]' \ '*:container name:_distrobox_containers'
same for distrobox-rm
#compdef distrobox-rm _distrobox_containers() { local -a containers containers=(${(f)"$(distrobox list --no-color | tail -n +2 | cut -d'|' -f2 | tr -d ' ')"}) _describe 'container name' containers } _arguments \ '(--all -a)'{-a,--all}'[delete all distroboxes]' \ '(--force -f)'{-f,--force}'[force deletion]' \ '--rm-home[remove the mounted home if it differs from the host users one]' \ '(--root -r)'{-r,--root}'[launch podman/docker/lilipod with root privileges]' \ '(--help -h)'{-h,--help}'[show this message]' \ '(--verbose -v)'{-v,--verbose}'[show more verbosity]' \ '(--version -V)'{-V,--version}'[show version]' \ '*:container name:_distrobox_containers'
The same issue in distrobox-stop, upgrade, etc.
To Reproduce
1. Create new container 2. In zsh, run `distrobox-enter <TAB>`
Expected behavior Expecting a list of available containers. But it returns a list of files in the local directory.
Desktop (please complete the following information):
* Are you using podman, docker or lilipod? Podman v5.1.1 * Which version of distrobox? distrobox v1.7.2.1 * Which host distribution? NixOS * How did you install distrobox? NixOS home-manager
Can you try these completions to see if these work better for you? Test them thoroughly and let me know if there's any problems. https://github.com/fredricocalamari/zsh-completions/tree/master/distrobox
Fixed in #1603
Describe the bug Running
distrobox-enter <TAB>
doesn't show the correct completion in zsh. It works correctly in bash. I think the zsh completions have a bug so I fixed it in my local machine and now completions work correctly. I don't know if this is a "shippable" fix but I wanted to share here.same for distrobox-rm
The same issue in distrobox-stop, upgrade, etc.
To Reproduce
distrobox-enter <TAB>
Expected behavior Expecting a list of available containers. But it returns a list of files in the local directory.
Desktop (please complete the following information):
Are you using podman, docker or lilipod? Podman v5.1.1
Which version of distrobox? distrobox v1.7.2.1
Which host distribution? NixOS
How did you install distrobox? NixOS home-manager