diff options
Diffstat (limited to 'completions/bash/podman')
-rw-r--r-- | completions/bash/podman | 154 |
1 files changed, 151 insertions, 3 deletions
diff --git a/completions/bash/podman b/completions/bash/podman index a85574d10..08891563c 100644 --- a/completions/bash/podman +++ b/completions/bash/podman @@ -32,6 +32,9 @@ __podman_containers() { __podman_q ps --format "$format" "$@" } +__podman_list_registries() { + sed -n -e '/registries.*=/ {s/.*\[\([^]]*\).*/\1/p;q}' /etc/containers/registries.conf | sed -e "s/[,']//g" +} # __podman_pods returns a list of pods. Additional options to # `podman pod ps` may be specified in order to filter the list, e.g. @@ -47,10 +50,10 @@ __podman_pods() { format='{{.ID}}' shift elif [ "$1" = "--name" ] ; then - format='{{.Names}}' + format='{{.Name}}' shift else - format='{{.Names}}' + format='{{.Name}}' fi __podman_q pod ps --format "$format" "$@" } @@ -365,6 +368,7 @@ __podman_subcommands() { local subcommands="$1" local counter=$(($command_pos + 1)) + while [ $counter -lt $cword ]; do case "${words[$counter]}" in $(__podman_to_extglob "$subcommands") ) @@ -1111,6 +1115,8 @@ _podman_exec() { --env --user -u + --workdir + -w " local boolean_options=" --help @@ -1194,7 +1200,14 @@ _podman_import() { COMPREPLY=($(compgen -W "$boolean_options $options_with_args" -- "$cur")) ;; *) - __podman_list_images + local counter=$( __podman_pos_first_nonflag "$options_with_args" ) + if [ "$cword" -eq "$((counter))" ]; then + __podman_complete_images --repo --tag + return + else + _filedir + return + fi ;; esac } @@ -1287,7 +1300,9 @@ _podman_image() { push rm save + sign tag + trust " local aliases=" list @@ -1499,6 +1514,8 @@ _podman_umount() { -h --force -f + --latest + -l " local options_with_args=" " @@ -1516,8 +1533,12 @@ _podman_umount() { _podman_mount() { local boolean_options=" + --all + -a --help -h + -l + --latest --notruncate " @@ -2271,10 +2292,26 @@ _podman_generate_kube() { local options_with_args="" local boolean_options=" + -h + --help -s --service " + case "$cur" in + -*) + COMPREPLY=($(compgen -W "$boolean_options $options_with_args" -- "$cur")) + ;; + *) + COMPREPLY=( $( compgen -W " + $(__podman_containers --all) + $(__podman_pods) + " -- "$cur" ) ) + __ltrim_colon_completions "$cur" + ;; + esac +} + _podman_play_kube() { local options_with_args=" --authfile @@ -2291,6 +2328,16 @@ _podman_play_kube() { --tls-verify " + case "$cur" in + -*) + COMPREPLY=($(compgen -W "$boolean_options $options_with_args" -- "$cur")) + ;; + *) + _filedir + ;; + esac +} + _podman_container_runlabel() { local options_with_args=" --authfile @@ -2321,6 +2368,92 @@ _podman_container_runlabel() { esac } +_podman_image_sign() { + local options_with_args=" + -d + --directory + --sign-by + " + local boolean_options=" + --help + -h + " + case "$cur" in + -*) + COMPREPLY=($(compgen -W "$boolean_options $options_with_args" -- "$cur")) + ;; + *) + __podman_complete_images + ;; + esac +} + +_podman_image_trust_set() { + echo hello + local options_with_args=" + -f + --type + --pubkeysfile + " + local boolean_options=" + --help + -h + " + case "$cur" in + -*) + COMPREPLY=($(compgen -W "$boolean_options $options_with_args" -- "$cur")) + ;; + *) + COMPREPLY=($(compgen -W "default $( __podman_list_registries )" -- "$cur")) + ;; + esac +} + +_podman_image_trust_show() { + local options_with_args=" + " + local boolean_options=" + --help + -h + -j + --json + --raw + " + case "$cur" in + -*) + COMPREPLY=($(compgen -W "$boolean_options $options_with_args" -- "$cur")) + ;; + *) + __podman_complete_images + ;; + esac +} + +_podman_image_trust() { + local boolean_options=" + --help + -h + " + subcommands=" + set + show + " + local aliases=" + list + " + command=image_trust + __podman_subcommands "$subcommands $aliases" && return + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) ) + ;; + esac +} + _podman_images_prune() { local options_with_args=" " @@ -2329,6 +2462,11 @@ _podman_images_prune() { -h --help " + case "$cur" in + -*) + COMPREPLY=($(compgen -W "$boolean_options $options_with_args" -- "$cur")) + ;; + esac } _podman_container_prune() { @@ -2347,6 +2485,15 @@ _podman_container_exists() { local boolean_options=" " + case "$cur" in + -*) + COMPREPLY=($(compgen -W "$boolean_options $options_with_args" -- "$cur")) + ;; + *) + __podman_complete_images + ;; + esac + } _podman_pod_exists() { @@ -2778,6 +2925,7 @@ _podman_podman() { export generate history + image images import info |