Skip to content

Commit eb774e7

Browse files
committed
Add bash completion for manifest lists and manifests
This completion is a simplification: - There is no command to retrieve manifest lists. They appear among the images after being pushed and pulled back. The completion lists all images. - The list returned by `docker images` also contains manifest lists. As we cannot filter these out, we again complete all images. Signed-off-by: Harald Albers <github@albersweb.de>
1 parent 4e4f8b2 commit eb774e7

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

contrib/completion/bash/docker

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3865,6 +3865,10 @@ _docker_manifest_annotate() {
38653865
COMPREPLY=( $( compgen -W "--arch --help --os --os-features --variant" -- "$cur" ) )
38663866
;;
38673867
*)
3868+
local counter=$( __docker_pos_first_nonflag "--arch|--os|--os-features|--variant" )
3869+
if [ "$cword" -eq "$counter" ] || [ "$cword" -eq "$((counter + 1))" ]; then
3870+
__docker_complete_images --force-tag --id
3871+
fi
38683872
;;
38693873
esac
38703874
}
@@ -3875,6 +3879,7 @@ _docker_manifest_create() {
38753879
COMPREPLY=( $( compgen -W "--amend -a --help --insecure" -- "$cur" ) )
38763880
;;
38773881
*)
3882+
__docker_complete_images --force-tag --id
38783883
;;
38793884
esac
38803885
}
@@ -3885,6 +3890,10 @@ _docker_manifest_inspect() {
38853890
COMPREPLY=( $( compgen -W "--help --insecure --verbose -v" -- "$cur" ) )
38863891
;;
38873892
*)
3893+
local counter=$( __docker_pos_first_nonflag )
3894+
if [ "$cword" -eq "$counter" ] || [ "$cword" -eq "$((counter + 1))" ]; then
3895+
__docker_complete_images --force-tag --id
3896+
fi
38883897
;;
38893898
esac
38903899
}
@@ -3895,6 +3904,10 @@ _docker_manifest_push() {
38953904
COMPREPLY=( $( compgen -W "--help --insecure --purge -p" -- "$cur" ) )
38963905
;;
38973906
*)
3907+
local counter=$( __docker_pos_first_nonflag )
3908+
if [ "$cword" -eq "$counter" ]; then
3909+
__docker_complete_images --force-tag --id
3910+
fi
38983911
;;
38993912
esac
39003913
}

0 commit comments

Comments
 (0)