Commit Graph

4 Commits

Author SHA1 Message Date
Ed Santiago 3b2aa033c8 Usage messages: show possible option values
...in a consistent manner: ("a"|"b"|"c")

This makes it possible (and easy) for zsh completion to
pick those out of the --help messages and offer them
as values when user hits TAB.

I chose this format because it's an already-existing
convention in cmd/podman/common.go.

Also: removed two duplicate "default: x" messages (Cobra
displays those automatically where a non-null default
is specified).

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-01-08 14:24:43 -07:00
Ed Santiago 3467f24fce zsh completion: ignore multi-line output in Flags
PR #4475 introduced an interesting twist on --help: a help
string that spans multiple lines. This broke zsh completion.

I'm not keen on that multi-line output, but it shouldn't
break completion. Fix is simple: look only for flag lines
beginning with '-', filter out anything else.

Fixes: #4738

Signed-off-by: Ed Santiago <santiago@redhat.com>
2019-12-23 06:28:49 -07:00
Dmitry Smirnov 8d928d525f codespell: spelling corrections
Signed-off-by: Dmitry Smirnov <onlyjob@member.fsf.org>
2019-11-13 08:15:00 +11:00
Ed Santiago 6aa8078cc1 zsh completion
Weekend hack by someone who doesn't grok zsh completion
but who finds it deeply offensive that most completion
files have an unmaintainable duplication of options
and arguments. The idea behind this one is to discover
the command line using --help, with a few hardcoded
helpers for discovering containers, images, pods,
and figuring out which args take files/dirs as args.

Working remarkably well. I am using this in my daily
routine and wondering how I ever managed without it.
It's not perfect -- a future version can perhaps
show only stopped containers for podman rm, only
running ones for podman stop -- but ROI seems low
on that given my limited zsh completion skills.

Sadly, I can't figure out how to write a regression
test suite for this. It would be lovely to have a
list if partial command lines and expected completions,
because the history of this change is that (seemingly)
minor tweaks in one place cause breakage in another.
Does anyone know of such a framework?

Still... working well enough to ship, IMO.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2019-03-13 16:40:07 -06:00