/kind feature
Description
There is already a bash completion for podman, but none for zsh.
Coming from docker I am used to the completion of commands and really miss them when using podman right now.
Steps to reproduce the issue:
source /usr/share/bash-completion/completions/podman - this is were the completion is put on Arch LinuxDescribe the results you received:
basename: missing operand
Try 'basename --help' for more information.
/usr/share/bash-completion/completions/podman:4: command not found: shopt
/usr/share/bash-completion/completions/podman:5: command not found: shopt
/usr/share/bash-completion/completions/podman:3008: command not found: complete
Describe the results you expected:
Using Podman with a running zsh completion
Additional information you deem important (e.g. issue happens only occasionally):
Output of podman version:
Version: 1.0.0
Go Version: go1.11.5
Git Commit: ""
Built: Sat Jan 26 19:17:55 2019
OS/Arch: linux/amd64
@metalmatze Patches welcomed. I would love to see them, but no one is using Zsh on our team.
It looks like Cobra can autogenerate completions for us?
https://github.com/spf13/cobra/blob/master/bash_completions.md
That might do ZSH completions too
There is a small comment about zsh but I don't see much else.
This is what I can get autogenerated with cobra.
https://paste.fedoraproject.org/paste/zARxPPTMDbnqcPN-bPx8Fw
@metalmatze Would this be valuable to you?
Sadly here is what it creates for bash completions.
https://paste.fedoraproject.org/paste/br2zBdxOPeOHlwBfYC-5XQ
Obviously a hell of a lot further along.
@metalmatze Looks lke you or someone else in the upstream is going to need to add zsh completions. No-one on our team uses it.
I think @edsantiago mentioned doing something related to this
I use zsh, and have been working on podman completion as a weekend project. I'm very new to completion concepts, and although I've come up with something that works for 90% of my purposes, it's still pretty broken for the other 10%. If you'd like to use it as it is, perhaps even contribute to it, my current working branch is https://github.com/edsantiago/libpod/tree/zsh_completion
Update: better link, to the completion file itself. Save it somewhere in your $fpath.
@metalmatze see #2637. It's working pretty well in my daily use.
@metalmatze Please review, if this works for you we can merge.
I've tried to run source ~/src/github.com/containers/libpod/completions/zsh/_podman and then to use the completion by running podman <TAB>. I might be doing something wrong, so far it doesn't work. :confused:
@metalmatze try:
$ mkdir -p ~/.zsh/completion
[save _podman in this directory]
$ fpath=(~/.zsh/completion $fpath)
$ unset -f _podman;rm -f ~/.zcompdump;compinit
(the unset may fail, that's ok)
That works! Great.
Thank you so much the work on this.
We now have zsh completions. Closing.
Not sure if I am late, but current podman completions were not working for me, and there was no antigen/oh-my-zsh plugin available for podman as well. also current _podman completions file felt incomplete to me, just because docker's completion file was 3k lines long and podmans was ~180? I can be wrong here.
So basically I cheated and copied docker zsh completions file from oh-my-zsh plugin, replaced docker with podman in vim with :%s/docker/podman/g and now I have full podman completions working :P pretty sure this should not cause any problems as podman cli provides same command line front end like docker according to docs.
@Sparkenstein a PR has just merged (in the last week) that vastly improves zsh/bash/fish completion. It will be in the next release.
Most helpful comment
I use zsh, and have been working on podman completion as a weekend project. I'm very new to completion concepts, and although I've come up with something that works for 90% of my purposes, it's still pretty broken for the other 10%. If you'd like to use it as it is, perhaps even contribute to it, my current working branch is https://github.com/edsantiago/libpod/tree/zsh_completion
Update: better link, to the completion file itself. Save it somewhere in your
$fpath.