1
0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2026-02-12 05:49:47 +08:00

Compare commits

...

3 Commits

Author SHA1 Message Date
Matthias Heyman
54779e5250
fix(jira): support identifiers delimited with a hyphen (#11782)
Co-authored-by: Matthias Heyman <matthias.heyman@ebo-enterprises.com>
2023-06-29 13:29:14 +02:00
Andrei Polushin
73c4764e78
fix(docker): use docker --version instead of docker version
`docker version` subcommand is able to return both docker client and
docker daemon information.  To get a daemon version, it connects to a
possibly remote daemon.  If the remote daemon is not accessible, the
client waits for some time, until it gets interrupted by timeout.

As a result we can have a docker client running in background. When zsh
session is rather short, a terminal application (iTerm2) starts asking
if that background docker process should be stopped.

On the other hand, to get a docker client version only, we can use
`docker --version` instead. It does not connect to a daemon.

Closes #11780
2023-06-29 13:26:08 +02:00
Carlo Sala
723af07a56
fix(docker): add static completion script 2023-06-29 13:25:05 +02:00
3 changed files with 3136 additions and 2 deletions

3126
plugins/docker/_docker Normal file

File diff suppressed because it is too large Load Diff

View File

@ -37,8 +37,10 @@ if (( ! $+commands[docker] )); then
fi fi
{ {
# docker version returns `Docker version 24.0.2, build cb74dfcd85`
# with `s:,:` remove the comma after the version, and select third word of it
local _docker_version=${${(s:,:z)"$(command docker --version)"}[3]}
# `docker completion` is only available from 23.0.0 on # `docker completion` is only available from 23.0.0 on
local _docker_version=$(command docker version --format '{{.Client.Version}}' 2>/dev/null)
if is-at-least 23.0.0 $_docker_version; then if is-at-least 23.0.0 $_docker_version; then
# If the completion file doesn't exist yet, we need to autoload it and # If the completion file doesn't exist yet, we need to autoload it and
# bind it to `docker`. Otherwise, compinit will have already done that. # bind it to `docker`. Otherwise, compinit will have already done that.

View File

@ -80,7 +80,13 @@ function jira() {
issue_arg=${issue_arg##*/} issue_arg=${issue_arg##*/}
# Strip suffixes starting with _ # Strip suffixes starting with _
issue_arg=(${(s:_:)issue_arg}) issue_arg=(${(s:_:)issue_arg})
issue_arg=${issue_arg[1]} # If there is only one part, it means that there is a different delimiter. Try with -
if [[ ${#issue_arg[@]} = 1 && ${issue_arg} == *-* ]]; then
issue_arg=(${(s:-:)issue_arg})
issue_arg="${issue_arg[1]}-${issue_arg[2]}"
else
issue_arg=${issue_arg[1]}
fi
if [[ "${issue_arg:l}" = ${jira_prefix:l}* ]]; then if [[ "${issue_arg:l}" = ${jira_prefix:l}* ]]; then
issue="${issue_arg}" issue="${issue_arg}"
else else