Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
oh-my-zsh
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
github
oh-my-zsh
Commits
7d5e1250
Unverified
Commit
7d5e1250
authored
Jul 20, 2023
by
Carlo Sala
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(docker): add `legacy-completion` option
parent
c4392a4d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
13 deletions
+23
-13
README.md
plugins/docker/README.md
+10
-1
docker.plugin.zsh
plugins/docker/docker.plugin.zsh
+13
-12
No files found.
plugins/docker/README.md
View file @
7d5e1250
...
...
@@ -30,6 +30,15 @@ file**, but be aware of the side effects:
> zstyle ':completion:*:*:docker-*:*' option-stacking yes
> ```
### Use old-style completion
If the current completion does not work well for you, you can enable legacy completion instead with the
following setting. See https://github.com/ohmyzsh/ohmyzsh/issues/11789 for more information.
```
zsh
zstyle
':omz:plugins:docker'
legacy-completion
yes
```
## Aliases
| Alias | Command | Description |
...
...
@@ -58,7 +67,7 @@ file**, but be aware of the side effects:
| drm |
`docker container rm`
| Remove the specified container(s) |
| drm! |
`docker container rm -f`
| Force the removal of a running container (uses SIGKILL) |
| dst |
`docker container start`
| Start one or more stopped containers |
| drs |
`docker container restart`
| Restart one or more containers
| drs |
`docker container restart`
| Restart one or more containers
|
| dsta |
`docker stop $(docker ps -q)`
| Stop all running containers |
| dstp |
`docker container stop`
| Stop one or more running containers |
| dtop |
`docker top`
| Display the running processes of a container |
...
...
plugins/docker/docker.plugin.zsh
View file @
7d5e1250
...
...
@@ -41,21 +41,22 @@ fi
0
=
"
${${
ZERO
:-${
0
:#
$ZSH_ARGZERO
}}:-${
(%)
:-
%N
}}
"
0
=
"
${${
(M)0
:#/
*
}:-
$PWD
/
$0
}
"
{
# 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
if
is-at-least 23.0.0
$_docker_version
;
then
# 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.
if
[[
!
-f
"
$ZSH_CACHE_DIR
/completions/_docker"
]]
;
then
# 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.
if
[[
!
-f
"
$ZSH_CACHE_DIR
/completions/_docker"
]]
;
then
typeset
-g
-A
_comps
autoload
-Uz
_docker
_comps[docker]
=
_docker
fi
command
docker completion zsh
>
|
"
$ZSH_CACHE_DIR
/completions/_docker"
else
fi
{
# `docker completion` is only available from 23.0.0 on
# docker version returns `Docker version 24.0.2, build cb74dfcd85`
# with `s:,:` remove the comma after the version, and select third word of it
if
zstyle
-t
':omz:plugins:docker'
legacy-completion
||
\
!
is-at-least 23.0.0
${${
(s
:,:z
)
"
$(
command
docker
--version
)
"
}
[3]
}
;
then
command cp
"
${
0
:h
}
/completions/_docker"
"
$ZSH_CACHE_DIR
/completions/_docker"
else
command
docker completion zsh
>
|
"
$ZSH_CACHE_DIR
/completions/_docker"
fi
}
&|
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment