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
hcloud: Add autocomplete support for bash and zsh #46001
Conversation
$bin/share/zsh/vendor-completions | ||
|
||
$bin/bin/hcloud completion bash > "$bin/etc/bash_completion.d/hcloud" | ||
$bin/bin/hcloud completion zsh > "$bin/share/zsh/vendor-completions/hcloud" |
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.
Did not work for me with zsh, I had to use
source <(hcloud completion zsh)
instead.
Also this variant did not work for me: https://git.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/hcloud#n49
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.
maybe the file needs to be _hcloud ? (that's the pattern I have previously seen).
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.
No, this was not the problem.
Currently one would need to manually run the command to generate completion and insert it into `.bashrc`/`.zshrc` to get the autocompletion to work. This patch will automatically generate both docs and save them to correct position so it should continue to work even if user changes the shell at a later stage.
5c20ca6
to
d23c357
Compare
@teto @Mic92 So, I'm no zsh/zsh-completion expert but I made a bit of investigation and per my understanding there are two things in play: first is the underscore - per my understanding, we need to mark it with underscore so that zsh recognizes it as a widget:
At least I couldn't find an explanation for filenames explicitly. The second is that
Anyway, should work now 🙂 I'll be submitting a patch upstream but it might be a while before it it gets submitted so I propose we amend the file ourselves for the time being. I'll also submit a patch for restic since it doesn't seem to work for me either until I rename it to |
zsh requires for files to be prepended with underscore to be recognized as widgets, see [1] for more details. [1] NixOS#46001 (comment)
zsh requires for files to be prepended with underscore to be recognized as widgets, see [1] for more details. [1] #46001 (comment) (cherry picked from commit e9fe3a3)
backport: [detached HEAD 0be6045] hcloud: Add autocomplete support for bash and zsh |
Motivation for this change
Currently one would need to manually run the command to generate
completion and insert it into
.bashrc
/.zshrc
to get theautocompletion to work. This patch will automatically generate
both docs and save them to correct position so it should continue
to work even if user changes the shell at a later stage.
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)I don't personally use zsh so I didn't test that but I found the correct path in
restic/default.nix
so I think we should be fine. If anyone has any issues please let me know and I'll remove zsh support (better yet, much obliged if you do use zsh and can verify it works as expected 😊 ).