diff options
36 files changed, 20638 insertions, 385 deletions
@@ -106,5 +106,10 @@ if [ -f /etc/bash_completion ]; then . /etc/bash_completion fi -export NACL_INC_DIR=/home/tobiask/nacl/nacl-20110221/build/ziws06/include/amd64 -export NACL_LIB_DIR=/home/tobiask/nacl/nacl-20110221/build/ziws06/lib/amd64 +CARGO_ENV="$HOME/.cargo/env" +if [ -f $CARGO_ENV ]; then + . $CARGO_ENV +fi +source "$HOME/.cargo/env" + +[ -f ~/.fzf.bash ] && source ~/.fzf.bash diff --git a/.fzf.bash b/.fzf.bash new file mode 100644 index 0000000..703aeb5 --- /dev/null +++ b/.fzf.bash @@ -0,0 +1,13 @@ +# Setup fzf +# --------- +if [[ ! "$PATH" == */home/tklauser/.fzf/bin* ]]; then + export PATH="${PATH:+${PATH}:}/home/tklauser/.fzf/bin" +fi + +# Auto-completion +# --------------- +[[ $- == *i* ]] && source "/home/tklauser/.fzf/shell/completion.bash" 2> /dev/null + +# Key bindings +# ------------ +source "/home/tklauser/.fzf/shell/key-bindings.bash" diff --git a/.zprofile b/.zprofile new file mode 100644 index 0000000..c515bf9 --- /dev/null +++ b/.zprofile @@ -0,0 +1,13 @@ +# .zprofile +# +# Base zprofile file which simply delegates to files in $ZDOTDIR +# +# Copyright © 2022 Tobias Klauser <tklauser@distanz.ch> +# +# Source repository: git://git.distanz.ch/dotfiles/zsh.git +# +# Based on the zsh setup by martin f. krafft which can be found at: +# git://git.madduck.net/etc/zsh.git + +ZDOTDIR=$HOME/.zsh +[ -f $ZDOTDIR/.zprofile ] && . $ZDOTDIR/.zprofile diff --git a/.zsh/completion/_cargo.zsh b/.zsh/completion/_cargo.zsh new file mode 100644 index 0000000..87e38cf --- /dev/null +++ b/.zsh/completion/_cargo.zsh @@ -0,0 +1,2 @@ +#compdef cargo +source $(rustc --print sysroot)/share/zsh/site-functions/_cargo diff --git a/.zsh/completion/_cilium.zsh b/.zsh/completion/_cilium.zsh new file mode 100644 index 0000000..8883ee4 --- /dev/null +++ b/.zsh/completion/_cilium.zsh @@ -0,0 +1,212 @@ +#compdef cilium +compdef _cilium cilium + +# zsh completion for cilium -*- shell-script -*- + +__cilium_debug() +{ + local file="$BASH_COMP_DEBUG_FILE" + if [[ -n ${file} ]]; then + echo "$*" >> "${file}" + fi +} + +_cilium() +{ + local shellCompDirectiveError=1 + local shellCompDirectiveNoSpace=2 + local shellCompDirectiveNoFileComp=4 + local shellCompDirectiveFilterFileExt=8 + local shellCompDirectiveFilterDirs=16 + local shellCompDirectiveKeepOrder=32 + + local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace keepOrder + local -a completions + + __cilium_debug "\n========= starting completion logic ==========" + __cilium_debug "CURRENT: ${CURRENT}, words[*]: ${words[*]}" + + # The user could have moved the cursor backwards on the command-line. + # We need to trigger completion from the $CURRENT location, so we need + # to truncate the command-line ($words) up to the $CURRENT location. + # (We cannot use $CURSOR as its value does not work when a command is an alias.) + words=("${=words[1,CURRENT]}") + __cilium_debug "Truncated words[*]: ${words[*]}," + + lastParam=${words[-1]} + lastChar=${lastParam[-1]} + __cilium_debug "lastParam: ${lastParam}, lastChar: ${lastChar}" + + # For zsh, when completing a flag with an = (e.g., cilium -n=<TAB>) + # completions must be prefixed with the flag + setopt local_options BASH_REMATCH + if [[ "${lastParam}" =~ '-.*=' ]]; then + # We are dealing with a flag with an = + flagPrefix="-P ${BASH_REMATCH}" + fi + + # Prepare the command to obtain completions + requestComp="${words[1]} __complete ${words[2,-1]}" + if [ "${lastChar}" = "" ]; then + # If the last parameter is complete (there is a space following it) + # We add an extra empty parameter so we can indicate this to the go completion code. + __cilium_debug "Adding extra empty parameter" + requestComp="${requestComp} \"\"" + fi + + __cilium_debug "About to call: eval ${requestComp}" + + # Use eval to handle any environment variables and such + out=$(eval ${requestComp} 2>/dev/null) + __cilium_debug "completion output: ${out}" + + # Extract the directive integer following a : from the last line + local lastLine + while IFS='\n' read -r line; do + lastLine=${line} + done < <(printf "%s\n" "${out[@]}") + __cilium_debug "last line: ${lastLine}" + + if [ "${lastLine[1]}" = : ]; then + directive=${lastLine[2,-1]} + # Remove the directive including the : and the newline + local suffix + (( suffix=${#lastLine}+2)) + out=${out[1,-$suffix]} + else + # There is no directive specified. Leave $out as is. + __cilium_debug "No directive found. Setting do default" + directive=0 + fi + + __cilium_debug "directive: ${directive}" + __cilium_debug "completions: ${out}" + __cilium_debug "flagPrefix: ${flagPrefix}" + + if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then + __cilium_debug "Completion received error. Ignoring completions." + return + fi + + local activeHelpMarker="_activeHelp_ " + local endIndex=${#activeHelpMarker} + local startIndex=$((${#activeHelpMarker}+1)) + local hasActiveHelp=0 + while IFS='\n' read -r comp; do + # Check if this is an activeHelp statement (i.e., prefixed with $activeHelpMarker) + if [ "${comp[1,$endIndex]}" = "$activeHelpMarker" ];then + __cilium_debug "ActiveHelp found: $comp" + comp="${comp[$startIndex,-1]}" + if [ -n "$comp" ]; then + compadd -x "${comp}" + __cilium_debug "ActiveHelp will need delimiter" + hasActiveHelp=1 + fi + + continue + fi + + if [ -n "$comp" ]; then + # If requested, completions are returned with a description. + # The description is preceded by a TAB character. + # For zsh's _describe, we need to use a : instead of a TAB. + # We first need to escape any : as part of the completion itself. + comp=${comp//:/\\:} + + local tab="$(printf '\t')" + comp=${comp//$tab/:} + + __cilium_debug "Adding completion: ${comp}" + completions+=${comp} + lastComp=$comp + fi + done < <(printf "%s\n" "${out[@]}") + + # Add a delimiter after the activeHelp statements, but only if: + # - there are completions following the activeHelp statements, or + # - file completion will be performed (so there will be choices after the activeHelp) + if [ $hasActiveHelp -eq 1 ]; then + if [ ${#completions} -ne 0 ] || [ $((directive & shellCompDirectiveNoFileComp)) -eq 0 ]; then + __cilium_debug "Adding activeHelp delimiter" + compadd -x "--" + hasActiveHelp=0 + fi + fi + + if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then + __cilium_debug "Activating nospace." + noSpace="-S ''" + fi + + if [ $((directive & shellCompDirectiveKeepOrder)) -ne 0 ]; then + __cilium_debug "Activating keep order." + keepOrder="-V" + fi + + if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then + # File extension filtering + local filteringCmd + filteringCmd='_files' + for filter in ${completions[@]}; do + if [ ${filter[1]} != '*' ]; then + # zsh requires a glob pattern to do file filtering + filter="\*.$filter" + fi + filteringCmd+=" -g $filter" + done + filteringCmd+=" ${flagPrefix}" + + __cilium_debug "File filtering command: $filteringCmd" + _arguments '*:filename:'"$filteringCmd" + elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then + # File completion for directories only + local subdir + subdir="${completions[1]}" + if [ -n "$subdir" ]; then + __cilium_debug "Listing directories in $subdir" + pushd "${subdir}" >/dev/null 2>&1 + else + __cilium_debug "Listing directories in ." + fi + + local result + _arguments '*:dirname:_files -/'" ${flagPrefix}" + result=$? + if [ -n "$subdir" ]; then + popd >/dev/null 2>&1 + fi + return $result + else + __cilium_debug "Calling _describe" + if eval _describe $keepOrder "completions" completions $flagPrefix $noSpace; then + __cilium_debug "_describe found some completions" + + # Return the success of having called _describe + return 0 + else + __cilium_debug "_describe did not find completions." + __cilium_debug "Checking if we should do file completion." + if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then + __cilium_debug "deactivating file completion" + + # We must return an error code here to let zsh know that there were no + # completions found by _describe; this is what will trigger other + # matching algorithms to attempt to find completions. + # For example zsh can match letters in the middle of words. + return 1 + else + # Perform file completion + __cilium_debug "Activating file completion" + + # We must return the result of this command, so it must be the + # last command, or else we must store its result to return it. + _arguments '*:filename:_files'" ${flagPrefix}" + fi + fi + fi +} + +# don't run the completion function when being source-ed or eval-ed +if [ "$funcstack[1]" = "_cilium" ]; then + _cilium +fi diff --git a/.zsh/completion/_eksctl.zsh b/.zsh/completion/_eksctl.zsh new file mode 100644 index 0000000..8a89c9f --- /dev/null +++ b/.zsh/completion/_eksctl.zsh @@ -0,0 +1,1067 @@ +#compdef _eksctl eksctl + + +function _eksctl { + local -a commands + + _arguments -C \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' \ + "1: :->cmnds" \ + "*::arg:->args" + + case $state in + cmnds) + commands=( + "create:Create resource(s)" + "get:Get resource(s)" + "update:Update resource(s)" + "upgrade:Upgrade resource(s)" + "delete:Delete resource(s)" + "set:Set values" + "unset:Unset values" + "scale:Scale resources(s)" + "drain:Drain resource(s)" + "utils:Various utils" + "completion:Generates shell completion scripts" + "version:Output the version of eksctl" + "help:Help about any command" + ) + _describe "command" commands + ;; + esac + + case "$words[1]" in + create) + _eksctl_create + ;; + get) + _eksctl_get + ;; + update) + _eksctl_update + ;; + upgrade) + _eksctl_upgrade + ;; + delete) + _eksctl_delete + ;; + set) + _eksctl_set + ;; + unset) + _eksctl_unset + ;; + scale) + _eksctl_scale + ;; + drain) + _eksctl_drain + ;; + utils) + _eksctl_utils + ;; + completion) + _eksctl_completion + ;; + version) + _eksctl_version + ;; + help) + _eksctl_help + ;; + esac +} + + +function _eksctl_create { + local -a commands + + _arguments -C \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' \ + "1: :->cmnds" \ + "*::arg:->args" + + case $state in + cmnds) + commands=( + "cluster:Create a cluster" + "nodegroup:Create a nodegroup" + "iamserviceaccount:Create an iamserviceaccount - AWS IAM role bound to a Kubernetes service account" + "iamidentitymapping:Create an IAM identity mapping" + "fargateprofile:Create a Fargate profile" + ) + _describe "command" commands + ;; + esac + + case "$words[1]" in + cluster) + _eksctl_create_cluster + ;; + nodegroup) + _eksctl_create_nodegroup + ;; + iamserviceaccount) + _eksctl_create_iamserviceaccount + ;; + iamidentitymapping) + _eksctl_create_iamidentitymapping + ;; + fargateprofile) + _eksctl_create_fargateprofile + ;; + esac +} + +function _eksctl_create_cluster { + _arguments \ + '--alb-ingress-access[enable full access for alb-ingress-controller]' \ + '--appmesh-access[enable full access to AppMesh]' \ + '--asg-access[enable IAM policy for cluster-autoscaler]' \ + '--authenticator-role-arn[AWS IAM role to assume for authenticator]:' \ + '--auto-kubeconfig[save kubeconfig file by cluster name, e.g. "/home/tklauser/.kube/eksctl/clusters/beautiful-wardrobe-1581428364"]' \ + '--cfn-role-arn[IAM role used by CloudFormation to call AWS API on your behalf]:' \ + '(-f --config-file)'{-f,--config-file}'[load configuration from a file (or stdin if set to '\''-'\'')]:' \ + '--external-dns-access[enable IAM policy for external-dns]' \ + '--fargate[Create a Fargate profile scheduling pods in the default and kube-system namespaces onto Fargate]' \ + '--full-ecr-access[enable full access to ECR]' \ + '--install-vpc-controllers[Install VPC controller that'\''s required for Windows workloads]' \ + '--kubeconfig[path to write kubeconfig (incompatible with --auto-kubeconfig)]:' \ + '--managed[Create EKS-managed nodegroup]' \ + '--max-pods-per-node[maximum number of pods per node (set automatically if unspecified)]:' \ + '(-n --name)'{-n,--name}'[EKS cluster name (generated if unspecified, e.g. "beautiful-wardrobe-1581428364")]:' \ + '--node-ami[Advanced use cases only. If '\''static'\'' is supplied (default) then eksctl will use static AMIs; if '\''auto'\'' is supplied then eksctl will automatically set the AMI based on version/region/instance type; if any other value is supplied it will override the AMI to use for the nodes. Use with extreme care.]:' \ + '--node-ami-family[Advanced use cases only. If '\''AmazonLinux2'\'' is supplied (default), then eksctl will use the official AWS EKS AMIs (Amazon Linux 2); if '\''Ubuntu1804'\'' is supplied, then eksctl will use the official Canonical EKS AMIs (Ubuntu 18.04).]:' \ + '--node-labels[Extra labels to add when registering the nodes in the nodegroup, e.g. "partition=backend,nodeclass=hugememory"]:' \ + '(-P --node-private-networking)'{-P,--node-private-networking}'[whether to make nodegroup networking private]' \ + '*--node-security-groups[Attach additional security groups to nodes, so that it can be used to allow extra ingress/egress access from/to pods]:' \ + '(-t --node-type)'{-t,--node-type}'[node instance type]:' \ + '--node-volume-size[node volume size in GB]:' \ + '--node-volume-type[node volume type (valid options: gp2, io1, sc1, st1)]:' \ + '*--node-zones[(inherited from the cluster if unspecified)]:' \ + '--nodegroup-name[name of the nodegroup (generated if unspecified, e.g. "ng-111eb0c5")]:' \ + '(-N --nodes)'{-N,--nodes}'[total number of nodes (for a static ASG)]:' \ + '(-M --nodes-max)'{-M,--nodes-max}'[maximum nodes in ASG]:' \ + '(-m --nodes-min)'{-m,--nodes-min}'[minimum nodes in ASG]:' \ + '(-p --profile)'{-p,--profile}'[AWS credentials profile to use (overrides the AWS_PROFILE environment variable)]:' \ + '(-r --region)'{-r,--region}'[AWS region]:' \ + '--set-kubeconfig-context[if true then current-context will be set in kubeconfig; if a context is already set then it will be overwritten]' \ + '--ssh-access[control SSH access for nodes. Uses ~/.ssh/id_rsa.pub as default key path if enabled]' \ + '--ssh-public-key[SSH public key to use for nodes (import from local path, or use existing EC2 key pair)]:' \ + '--tags[A list of KV pairs used to tag the AWS resources (e.g. "Owner=John Doe,Team=Some Team")]:' \ + '--timeout[maximum waiting time for any long-running operation]:' \ + '--version[Kubernetes version (valid options: 1.12, 1.13, 1.14)]:' \ + '--vpc-cidr[global CIDR to use for VPC]:' \ + '--vpc-from-kops-cluster[re-use VPC from a given kops cluster]:' \ + '--vpc-nat-mode[VPC NAT mode, valid options: HighlyAvailable, Single, Disable]:' \ + '*--vpc-private-subnets[re-use private subnets of an existing VPC]:' \ + '*--vpc-public-subnets[re-use public subnets of an existing VPC]:' \ + '--without-nodegroup[if set, initial nodegroup will not be created]' \ + '--write-kubeconfig[toggle writing of kubeconfig]' \ + '*--zones[(auto-select if unspecified)]:' \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' +} + +function _eksctl_create_nodegroup { + _arguments \ + '--alb-ingress-access[enable full access for alb-ingress-controller]' \ + '--appmesh-access[enable full access to AppMesh]' \ + '--asg-access[enable IAM policy for cluster-autoscaler]' \ + '--cfn-role-arn[IAM role used by CloudFormation to call AWS API on your behalf]:' \ + '--cluster[name of the EKS cluster to add the nodegroup to]:' \ + '(-f --config-file)'{-f,--config-file}'[load configuration from a file (or stdin if set to '\''-'\'')]:' \ + '*--exclude[nodegroups to exclude (list of globs), e.g.: '\''ng-team-?,prod-*'\'']:' \ + '--external-dns-access[enable IAM policy for external-dns]' \ + '--full-ecr-access[enable full access to ECR]' \ + '*--include[nodegroups to include (list of globs), e.g.: '\''ng-team-?,prod-*'\'']:' \ + '--managed[Create EKS-managed nodegroup]' \ + '--max-pods-per-node[maximum number of pods per node (set automatically if unspecified)]:' \ + '(-n --name)'{-n,--name}'[name of the new nodegroup (generated if unspecified, e.g. "ng-cb0d148f")]:' \ + '--node-ami[Advanced use cases only. If '\''static'\'' is supplied (default) then eksctl will use static AMIs; if '\''auto'\'' is supplied then eksctl will automatically set the AMI based on version/region/instance type; if any other value is supplied it will override the AMI to use for the nodes. Use with extreme care.]:' \ + '--node-ami-family[Advanced use cases only. If '\''AmazonLinux2'\'' is supplied (default), then eksctl will use the official AWS EKS AMIs (Amazon Linux 2); if '\''Ubuntu1804'\'' is supplied, then eksctl will use the official Canonical EKS AMIs (Ubuntu 18.04).]:' \ + '--node-labels[Extra labels to add when registering the nodes in the nodegroup, e.g. "partition=backend,nodeclass=hugememory"]:' \ + '(-P --node-private-networking)'{-P,--node-private-networking}'[whether to make nodegroup networking private]' \ + '*--node-security-groups[Attach additional security groups to nodes, so that it can be used to allow extra ingress/egress access from/to pods]:' \ + '(-t --node-type)'{-t,--node-type}'[node instance type]:' \ + '--node-volume-size[node volume size in GB]:' \ + '--node-volume-type[node volume type (valid options: gp2, io1, sc1, st1)]:' \ + '*--node-zones[(inherited from the cluster if unspecified)]:' \ + '(-N --nodes)'{-N,--nodes}'[total number of nodes (for a static ASG)]:' \ + '(-M --nodes-max)'{-M,--nodes-max}'[maximum nodes in ASG]:' \ + '(-m --nodes-min)'{-m,--nodes-min}'[minimum nodes in ASG]:' \ + '(-p --profile)'{-p,--profile}'[AWS credentials profile to use (overrides the AWS_PROFILE environment variable)]:' \ + '(-r --region)'{-r,--region}'[AWS region]:' \ + '--ssh-access[control SSH access for nodes. Uses ~/.ssh/id_rsa.pub as default key path if enabled]' \ + '--ssh-public-key[SSH public key to use for nodes (import from local path, or use existing EC2 key pair)]:' \ + '--timeout[maximum waiting time for any long-running operation]:' \ + '--update-auth-configmap[Remove nodegroup IAM role from aws-auth configmap]' \ + '--version[Kubernetes version (valid options: 1.12, 1.13, 1.14) [for nodegroups "auto" and "latest" can be used to automatically inherit version from the control plane or force latest]]:' \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' +} + +function _eksctl_create_iamserviceaccount { + _arguments \ + '--approve[Apply the changes]' \ + '*--attach-policy-arn[ARN of the policy where to create the iamserviceaccount]:' \ + '--cfn-role-arn[IAM role used by CloudFormation to call AWS API on your behalf]:' \ + '--cluster[name of the EKS cluster to add the iamserviceaccount to]:' \ + '(-f --config-file)'{-f,--config-file}'[load configuration from a file (or stdin if set to '\''-'\'')]:' \ + '*--exclude[iamserviceaccounts to exclude (list of globs), e.g.: '\''default/s3-reader,*/dynamo-*'\'']:' \ + '*--include[iamserviceaccounts to include (list of globs), e.g.: '\''default/s3-reader,*/dynamo-*'\'']:' \ + '--name[name of the iamserviceaccount to create]:' \ + '--namespace[namespace where to create the iamserviceaccount]:' \ + '--override-existing-serviceaccounts[create IAM roles for existing serviceaccounts and update the serviceaccount]' \ + '(-p --profile)'{-p,--profile}'[AWS credentials profile to use (overrides the AWS_PROFILE environment variable)]:' \ + '(-r --region)'{-r,--region}'[AWS region]:' \ + '--timeout[maximum waiting time for any long-running operation]:' \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' +} + +function _eksctl_create_iamidentitymapping { + _arguments \ + '--arn[ARN of the IAM role or user to create]:' \ + '(-c --cluster)'{-c,--cluster}'[EKS cluster name]:' \ + '(-f --config-file)'{-f,--config-file}'[load configuration from a file (or stdin if set to '\''-'\'')]:' \ + '*--group[Group within Kubernetes to which IAM role is mapped]:' \ + '(-p --profile)'{-p,--profile}'[AWS credentials profile to use (overrides the AWS_PROFILE environment variable)]:' \ + '(-r --region)'{-r,--region}'[AWS region]:' \ + '--timeout[maximum waiting time for any long-running operation]:' \ + '--username[User name within Kubernetes to map to IAM role]:' \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' +} + +function _eksctl_create_fargateprofile { + _arguments \ + '(-c --cluster)'{-c,--cluster}'[EKS cluster name]:' \ + '(-f --config-file)'{-f,--config-file}'[load configuration from a file (or stdin if set to '\''-'\'')]:' \ + '(-l --labels)'{-l,--labels}'[Kubernetes selector labels of the workloads to schedule on Fargate, e.g. k1=v1,k2=v2]:' \ + '--name[Fargate profile'\''s name]:' \ + '--namespace[Kubernetes namespace of the workloads to schedule on Fargate]:' \ + '(-p --profile)'{-p,--profile}'[AWS credentials profile to use (overrides the AWS_PROFILE environment variable)]:' \ + '(-r --region)'{-r,--region}'[AWS region]:' \ + '--timeout[maximum waiting time for any long-running operation]:' \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' +} + + +function _eksctl_get { + local -a commands + + _arguments -C \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' \ + "1: :->cmnds" \ + "*::arg:->args" + + case $state in + cmnds) + commands=( + "cluster:Get cluster(s)" + "nodegroup:Get nodegroup(s)" + "iamserviceaccount:Get iamserviceaccount(s)" + "iamidentitymapping:Get IAM identity mapping(s)" + "labels:Get nodegroup labels" + "fargateprofile:Get Fargate profile(s)" + ) + _describe "command" commands + ;; + esac + + case "$words[1]" in + cluster) + _eksctl_get_cluster + ;; + nodegroup) + _eksctl_get_nodegroup + ;; + iamserviceaccount) + _eksctl_get_iamserviceaccount + ;; + iamidentitymapping) + _eksctl_get_iamidentitymapping + ;; + labels) + _eksctl_get_labels + ;; + fargateprofile) + _eksctl_get_fargateprofile + ;; + esac +} + +function _eksctl_get_cluster { + _arguments \ + '(-A --all-regions)'{-A,--all-regions}'[List clusters across all supported regions]' \ + '--chunk-size[return large lists in chunks rather than all at once, pass 0 to disable]:' \ + '(-n --name)'{-n,--name}'[EKS cluster name]:' \ + '(-o --output)'{-o,--output}'[specifies the output format (valid option: table, json, yaml)]:' \ + '(-p --profile)'{-p,--profile}'[AWS credentials profile to use (overrides the AWS_PROFILE environment variable)]:' \ + '(-r --region)'{-r,--region}'[AWS region]:' \ + '--timeout[maximum waiting time for any long-running operation]:' \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' +} + +function _eksctl_get_nodegroup { + _arguments \ + '--chunk-size[return large lists in chunks rather than all at once, pass 0 to disable]:' \ + '--cluster[EKS cluster name]:' \ + '(-n --name)'{-n,--name}'[Name of the nodegroup]:' \ + '(-o --output)'{-o,--output}'[specifies the output format (valid option: table, json, yaml)]:' \ + '(-p --profile)'{-p,--profile}'[AWS credentials profile to use (overrides the AWS_PROFILE environment variable)]:' \ + '(-r --region)'{-r,--region}'[AWS region]:' \ + '--timeout[maximum waiting time for any long-running operation]:' \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' +} + +function _eksctl_get_iamserviceaccount { + _arguments \ + '--chunk-size[return large lists in chunks rather than all at once, pass 0 to disable]:' \ + '--cluster[EKS cluster name]:' \ + '(-f --config-file)'{-f,--config-file}'[load configuration from a file (or stdin if set to '\''-'\'')]:' \ + '--name[name of the iamserviceaccount to delete]:' \ + '--namespace[namespace where to delete the iamserviceaccount]:' \ + '(-o --output)'{-o,--output}'[specifies the output format (valid option: table, json, yaml)]:' \ + '(-p --profile)'{-p,--profile}'[AWS credentials profile to use (overrides the AWS_PROFILE environment variable)]:' \ + '(-r --region)'{-r,--region}'[AWS region]:' \ + '--timeout[maximum waiting time for any long-running operation]:' \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' +} + +function _eksctl_get_iamidentitymapping { + _arguments \ + '--arn[ARN of the IAM role or user to create]:' \ + '--chunk-size[return large lists in chunks rather than all at once, pass 0 to disable]:' \ + '(-c --cluster)'{-c,--cluster}'[EKS cluster name]:' \ + '(-f --config-file)'{-f,--config-file}'[load configuration from a file (or stdin if set to '\''-'\'')]:' \ + '(-o --output)'{-o,--output}'[specifies the output format (valid option: table, json, yaml)]:' \ + '(-p --profile)'{-p,--profile}'[AWS credentials profile to use (overrides the AWS_PROFILE environment variable)]:' \ + '(-r --region)'{-r,--region}'[AWS region]:' \ + '--timeout[maximum waiting time for any long-running operation]:' \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' +} + +function _eksctl_get_labels { + _arguments \ + '--cluster[EKS cluster name]:' \ + '(-n --nodegroup)'{-n,--nodegroup}'[Nodegroup name]:' \ + '(-p --profile)'{-p,--profile}'[AWS credentials profile to use (overrides the AWS_PROFILE environment variable)]:' \ + '(-r --region)'{-r,--region}'[AWS region]:' \ + '--timeout[maximum waiting time for any long-running operation]:' \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' +} + +function _eksctl_get_fargateprofile { + _arguments \ + '--chunk-size[return large lists in chunks rather than all at once, pass 0 to disable]:' \ + '(-c --cluster)'{-c,--cluster}'[EKS cluster name]:' \ + '(-f --config-file)'{-f,--config-file}'[load configuration from a file (or stdin if set to '\''-'\'')]:' \ + '--name[Fargate profile'\''s name]:' \ + '(-o --output)'{-o,--output}'[specifies the output format (valid option: table, json, yaml)]:' \ + '(-p --profile)'{-p,--profile}'[AWS credentials profile to use (overrides the AWS_PROFILE environment variable)]:' \ + '(-r --region)'{-r,--region}'[AWS region]:' \ + '--timeout[maximum waiting time for any long-running operation]:' \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' +} + + +function _eksctl_update { + local -a commands + + _arguments -C \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' \ + "1: :->cmnds" \ + "*::arg:->args" + + case $state in + cmnds) + commands=( + "cluster:Update cluster" + ) + _describe "command" commands + ;; + esac + + case "$words[1]" in + cluster) + _eksctl_update_cluster + ;; + esac +} + +function _eksctl_update_cluster { + _arguments \ + '--approve[Apply the changes]' \ + '(-f --config-file)'{-f,--config-file}'[load configuration from a file (or stdin if set to '\''-'\'')]:' \ + '(-n --name)'{-n,--name}'[EKS cluster name]:' \ + '(-p --profile)'{-p,--profile}'[AWS credentials profile to use (overrides the AWS_PROFILE environment variable)]:' \ + '(-r --region)'{-r,--region}'[AWS region]:' \ + '--timeout[maximum waiting time for any long-running operation]:' \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' +} + + +function _eksctl_upgrade { + local -a commands + + _arguments -C \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' \ + "1: :->cmnds" \ + "*::arg:->args" + + case $state in + cmnds) + commands=( + "nodegroup:Upgrade nodegroup" + ) + _describe "command" commands + ;; + esac + + case "$words[1]" in + nodegroup) + _eksctl_upgrade_nodegroup + ;; + esac +} + +function _eksctl_upgrade_nodegroup { + _arguments \ + '--cluster[EKS cluster name]:' \ + '(-f --config-file)'{-f,--config-file}'[load configuration from a file (or stdin if set to '\''-'\'')]:' \ + '--kubernetes-version[Kubernetes version]:' \ + '--name[Nodegroup name]:' \ + '(-p --profile)'{-p,--profile}'[AWS credentials profile to use (overrides the AWS_PROFILE environment variable)]:' \ + '(-r --region)'{-r,--region}'[AWS region]:' \ + '--timeout[maximum waiting time for any long-running operation]:' \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' +} + + +function _eksctl_delete { + local -a commands + + _arguments -C \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' \ + "1: :->cmnds" \ + "*::arg:->args" + + case $state in + cmnds) + commands=( + "cluster:Delete a cluster" + "nodegroup:Delete a nodegroup" + "iamserviceaccount:Delete an IAM service account" + "iamidentitymapping:Delete a IAM identity mapping" + "fargateprofile:Delete Fargate profile" + ) + _describe "command" commands + ;; + esac + + case "$words[1]" in + cluster) + _eksctl_delete_cluster + ;; + nodegroup) + _eksctl_delete_nodegroup + ;; + iamserviceaccount) + _eksctl_delete_iamserviceaccount + ;; + iamidentitymapping) + _eksctl_delete_iamidentitymapping + ;; + fargateprofile) + _eksctl_delete_fargateprofile + ;; + esac +} + +function _eksctl_delete_cluster { + _arguments \ + '--cfn-role-arn[IAM role used by CloudFormation to call AWS API on your behalf]:' \ + '(-f --config-file)'{-f,--config-file}'[load configuration from a file (or stdin if set to '\''-'\'')]:' \ + '(-n --name)'{-n,--name}'[EKS cluster name]:' \ + '(-p --profile)'{-p,--profile}'[AWS credentials profile to use (overrides the AWS_PROFILE environment variable)]:' \ + '(-r --region)'{-r,--region}'[AWS region]:' \ + '--timeout[maximum waiting time for any long-running operation]:' \ + '(-w --wait)'{-w,--wait}'[wait for deletion of all resources before exiting]' \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' +} + +function _eksctl_delete_nodegroup { + _arguments \ + '--approve[Apply the changes]' \ + '--cfn-role-arn[IAM role used by CloudFormation to call AWS API on your behalf]:' \ + '--cluster[EKS cluster name]:' \ + '(-f --config-file)'{-f,--config-file}'[load configuration from a file (or stdin if set to '\''-'\'')]:' \ + '--drain[Drain and cordon all nodes in the nodegroup before deletion]' \ + '*--exclude[nodegroups to exclude (list of globs), e.g.: '\''ng-team-?,prod-*'\'']:' \ + '*--include[nodegroups to include (list of globs), e.g.: '\''ng-team-?,prod-*'\'']:' \ + '(-n --name)'{-n,--name}'[Name of the nodegroup to delete]:' \ + '--only-missing[Only delete nodegroups that are not defined in the given config file]' \ + '(-p --profile)'{-p,--profile}'[AWS credentials profile to use (overrides the AWS_PROFILE environment variable)]:' \ + '(-r --region)'{-r,--region}'[AWS region]:' \ + '--timeout[maximum waiting time for any long-running operation]:' \ + '--update-auth-configmap[Remove nodegroup IAM role from aws-auth configmap]' \ + '(-w --wait)'{-w,--wait}'[wait for deletion of all resources before exiting]' \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' +} + +function _eksctl_delete_iamserviceaccount { + _arguments \ + '--approve[Apply the changes]' \ + '--cfn-role-arn[IAM role used by CloudFormation to call AWS API on your behalf]:' \ + '--cluster[name of the EKS cluster to delete the iamserviceaccount from]:' \ + '(-f --config-file)'{-f,--config-file}'[load configuration from a file (or stdin if set to '\''-'\'')]:' \ + '*--exclude[iamserviceaccounts to exclude (list of globs), e.g.: '\''default/s3-reader,*/dynamo-*'\'']:' \ + '*--include[iamserviceaccounts to include (list of globs), e.g.: '\''default/s3-reader,*/dynamo-*'\'']:' \ + '--name[name of the iamserviceaccount to delete]:' \ + '--namespace[namespace where to delete the iamserviceaccount]:' \ + '--only-missing[Only delete nodegroups that are not defined in the given config file]' \ + '(-p --profile)'{-p,--profile}'[AWS credentials profile to use (overrides the AWS_PROFILE environment variable)]:' \ + '(-r --region)'{-r,--region}'[AWS region]:' \ + '--timeout[maximum waiting time for any long-running operation]:' \ + '(-w --wait)'{-w,--wait}'[wait for deletion of all resources before exiting]' \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' +} + +function _eksctl_delete_iamidentitymapping { + _arguments \ + '--all[Delete all matching mappings instead of just one]' \ + '--arn[ARN of the IAM role or user to create]:' \ + '(-c --cluster)'{-c,--cluster}'[EKS cluster name]:' \ + '(-f --config-file)'{-f,--config-file}'[load configuration from a file (or stdin if set to '\''-'\'')]:' \ + '(-p --profile)'{-p,--profile}'[AWS credentials profile to use (overrides the AWS_PROFILE environment variable)]:' \ + '(-r --region)'{-r,--region}'[AWS region]:' \ + '--timeout[maximum waiting time for any long-running operation]:' \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' +} + +function _eksctl_delete_fargateprofile { + _arguments \ + '(-c --cluster)'{-c,--cluster}'[EKS cluster name]:' \ + '(-f --config-file)'{-f,--config-file}'[load configuration from a file (or stdin if set to '\''-'\'')]:' \ + '--name[Fargate profile'\''s name]:' \ + '(-p --profile)'{-p,--profile}'[AWS credentials profile to use (overrides the AWS_PROFILE environment variable)]:' \ + '(-r --region)'{-r,--region}'[AWS region]:' \ + '--timeout[maximum waiting time for any long-running operation]:' \ + '(-w --wait)'{-w,--wait}'[wait for wait for the deletion of the Fargate profile, which may take from a couple seconds to a couple minutes. before exiting]' \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' +} + + +function _eksctl_set { + local -a commands + + _arguments -C \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' \ + "1: :->cmnds" \ + "*::arg:->args" + + case $state in + cmnds) + commands=( + "labels:Create or overwrite labels" + ) + _describe "command" commands + ;; + esac + + case "$words[1]" in + labels) + _eksctl_set_labels + ;; + esac +} + +function _eksctl_set_labels { + _arguments \ + '--cluster[EKS cluster name]:' \ + '(-l --labels)'{-l,--labels}'[Create Labels]:' \ + '(-n --nodegroup)'{-n,--nodegroup}'[Nodegroup name]:' \ + '(-p --profile)'{-p,--profile}'[AWS credentials profile to use (overrides the AWS_PROFILE environment variable)]:' \ + '(-r --region)'{-r,--region}'[AWS region]:' \ + '--timeout[maximum waiting time for any long-running operation]:' \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' +} + + +function _eksctl_unset { + local -a commands + + _arguments -C \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' \ + "1: :->cmnds" \ + "*::arg:->args" + + case $state in + cmnds) + commands=( + "labels:Create removeLabels" + ) + _describe "command" commands + ;; + esac + + case "$words[1]" in + labels) + _eksctl_unset_labels + ;; + esac +} + +function _eksctl_unset_labels { + _arguments \ + '--cluster[EKS cluster name]:' \ + '(*-l *--labels)'{\*-l,\*--labels}'[List of labels to remove]:' \ + '(-n --nodegroup)'{-n,--nodegroup}'[Nodegroup name]:' \ + '(-p --profile)'{-p,--profile}'[AWS credentials profile to use (overrides the AWS_PROFILE environment variable)]:' \ + '(-r --region)'{-r,--region}'[AWS region]:' \ + '--timeout[maximum waiting time for any long-running operation]:' \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' +} + + +function _eksctl_scale { + local -a commands + + _arguments -C \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' \ + "1: :->cmnds" \ + "*::arg:->args" + + case $state in + cmnds) + commands=( + "nodegroup:Scale a nodegroup" + ) + _describe "command" commands + ;; + esac + + case "$words[1]" in + nodegroup) + _eksctl_scale_nodegroup + ;; + esac +} + +function _eksctl_scale_nodegroup { + _arguments \ + '--cfn-role-arn[IAM role used by CloudFormation to call AWS API on your behalf]:' \ + '--cluster[EKS cluster name]:' \ + '(-n --name)'{-n,--name}'[Name of the nodegroup to scale]:' \ + '(-N --nodes)'{-N,--nodes}'[total number of nodes (scale to this number)]:' \ + '(-p --profile)'{-p,--profile}'[AWS credentials profile to use (overrides the AWS_PROFILE environment variable)]:' \ + '(-r --region)'{-r,--region}'[AWS region]:' \ + '--timeout[maximum waiting time for any long-running operation]:' \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' +} + + +function _eksctl_drain { + local -a commands + + _arguments -C \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' \ + "1: :->cmnds" \ + "*::arg:->args" + + case $state in + cmnds) + commands=( + "nodegroup:Cordon and drain a nodegroup" + ) + _describe "command" commands + ;; + esac + + case "$words[1]" in + nodegroup) + _eksctl_drain_nodegroup + ;; + esac +} + +function _eksctl_drain_nodegroup { + _arguments \ + '--approve[Apply the changes]' \ + '--cfn-role-arn[IAM role used by CloudFormation to call AWS API on your behalf]:' \ + '--cluster[EKS cluster name]:' \ + '(-f --config-file)'{-f,--config-file}'[load configuration from a file (or stdin if set to '\''-'\'')]:' \ + '*--exclude[nodegroups to exclude (list of globs), e.g.: '\''ng-team-?,prod-*'\'']:' \ + '*--include[nodegroups to include (list of globs), e.g.: '\''ng-team-?,prod-*'\'']:' \ + '(-n --name)'{-n,--name}'[Name of the nodegroup to delete]:' \ + '--only-missing[Only drain nodegroups that are not defined in the given config file]' \ + '(-p --profile)'{-p,--profile}'[AWS credentials profile to use (overrides the AWS_PROFILE environment variable)]:' \ + '(-r --region)'{-r,--region}'[AWS region]:' \ + '--timeout[maximum waiting time for any long-running operation]:' \ + '--undo[Uncordone the nodegroup]' \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' +} + + +function _eksctl_utils { + local -a commands + + _arguments -C \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' \ + "1: :->cmnds" \ + "*::arg:->args" + + case $state in + cmnds) + commands=( + "wait-nodes:Wait for nodes" + "write-kubeconfig:Write kubeconfig file for a given cluster" + "describe-stacks:Describe CloudFormation stack for a given cluster" + "update-cluster-stack:DEPRECATED: Use 'eksctl update cluster' instead" + "update-kube-proxy:Update kube-proxy add-on to ensure image matches Kubernetes control plane version" + "update-aws-node:Update aws-node add-on to latest released version" + "update-coredns:Update coredns add-on to ensure image matches the standard Amazon EKS version" + "update-cluster-logging:Update cluster logging configuration" + "associate-iam-oidc-provider:Setup IAM OIDC provider for a cluster to enable IAM roles for pods" + "install-vpc-controllers:Install Windows VPC controller to support running Windows workloads" + "update-cluster-endpoints:Update Kubernetes API endpoint access configuration" + "set-public-access-cidrs:Update public access CIDRs" + "nodegroup-health:Get nodegroup health for a managed node" + ) + _describe "command" commands + ;; + esac + + case "$words[1]" in + wait-nodes) + _eksctl_utils_wait-nodes + ;; + write-kubeconfig) + _eksctl_utils_write-kubeconfig + ;; + describe-stacks) + _eksctl_utils_describe-stacks + ;; + update-cluster-stack) + _eksctl_utils_update-cluster-stack + ;; + update-kube-proxy) + _eksctl_utils_update-kube-proxy + ;; + update-aws-node) + _eksctl_utils_update-aws-node + ;; + update-coredns) + _eksctl_utils_update-coredns + ;; + update-cluster-logging) + _eksctl_utils_update-cluster-logging + ;; + associate-iam-oidc-provider) + _eksctl_utils_associate-iam-oidc-provider + ;; + install-vpc-controllers) + _eksctl_utils_install-vpc-controllers + ;; + update-cluster-endpoints) + _eksctl_utils_update-cluster-endpoints + ;; + set-public-access-cidrs) + _eksctl_utils_set-public-access-cidrs + ;; + nodegroup-health) + _eksctl_utils_nodegroup-health + ;; + esac +} + +function _eksctl_utils_wait-nodes { + _arguments \ + '--kubeconfig[path to read kubeconfig]:' \ + '(-m --nodes-min)'{-m,--nodes-min}'[minimum number of nodes to wait for]:' \ + '--timeout[how long to wait]:' \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' +} + +function _eksctl_utils_write-kubeconfig { + _arguments \ + '--authenticator-role-arn[AWS IAM role to assume for authenticator]:' \ + '--auto-kubeconfig[save kubeconfig file by cluster name, e.g. "/home/tklauser/.kube/eksctl/clusters/<name>"]' \ + '(-c --cluster)'{-c,--cluster}'[EKS cluster name]:' \ + '--kubeconfig[path to write kubeconfig (incompatible with --auto-kubeconfig)]:' \ + '(-p --profile)'{-p,--profile}'[AWS credentials profile to use (overrides the AWS_PROFILE environment variable)]:' \ + '(-r --region)'{-r,--region}'[AWS region]:' \ + '--set-kubeconfig-context[if true then current-context will be set in kubeconfig; if a context is already set then it will be overwritten]' \ + '--timeout[maximum waiting time for any long-running operation]:' \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' +} + +function _eksctl_utils_describe-stacks { + _arguments \ + '--all[include deleted stacks]' \ + '(-c --cluster)'{-c,--cluster}'[EKS cluster name]:' \ + '--events[include stack events]' \ + '(-p --profile)'{-p,--profile}'[AWS credentials profile to use (overrides the AWS_PROFILE environment variable)]:' \ + '(-r --region)'{-r,--region}'[AWS region]:' \ + '--timeout[maximum waiting time for any long-running operation]:' \ + '--trail[lookup CloudTrail events for the cluster]' \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' +} + +function _eksctl_utils_update-cluster-stack { + _arguments \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' +} + +function _eksctl_utils_update-kube-proxy { + _arguments \ + '--approve[Apply the changes]' \ + '(-c --cluster)'{-c,--cluster}'[EKS cluster name]:' \ + '(-f --config-file)'{-f,--config-file}'[load configuration from a file (or stdin if set to '\''-'\'')]:' \ + '(-p --profile)'{-p,--profile}'[AWS credentials profile to use (overrides the AWS_PROFILE environment variable)]:' \ + '(-r --region)'{-r,--region}'[AWS region]:' \ + '--timeout[maximum waiting time for any long-running operation]:' \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' +} + +function _eksctl_utils_update-aws-node { + _arguments \ + '--approve[Apply the changes]' \ + '(-c --cluster)'{-c,--cluster}'[EKS cluster name]:' \ + '(-f --config-file)'{-f,--config-file}'[load configuration from a file (or stdin if set to '\''-'\'')]:' \ + '(-p --profile)'{-p,--profile}'[AWS credentials profile to use (overrides the AWS_PROFILE environment variable)]:' \ + '(-r --region)'{-r,--region}'[AWS region]:' \ + '--timeout[maximum waiting time for any long-running operation]:' \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' +} + +function _eksctl_utils_update-coredns { + _arguments \ + '--approve[Apply the changes]' \ + '(-c --cluster)'{-c,--cluster}'[EKS cluster name]:' \ + '(-f --config-file)'{-f,--config-file}'[load configuration from a file (or stdin if set to '\''-'\'')]:' \ + '(-p --profile)'{-p,--profile}'[AWS credentials profile to use (overrides the AWS_PROFILE environment variable)]:' \ + '(-r --region)'{-r,--region}'[AWS region]:' \ + '--timeout[maximum waiting time for any long-running operation]:' \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' +} + +function _eksctl_utils_update-cluster-logging { + _arguments \ + '--approve[Apply the changes]' \ + '(-c --cluster)'{-c,--cluster}'[EKS cluster name]:' \ + '(-f --config-file)'{-f,--config-file}'[load configuration from a file (or stdin if set to '\''-'\'')]:' \ + '*--disable-types[Log types to be disabled, the rest will be disabled. Supported log types: (all, none, api, audit, authenticator, controllerManager, scheduler)]:' \ + '*--enable-types[Log types to be enabled. Supported log types: (all, none, api, audit, authenticator, controllerManager, scheduler)]:' \ + '(-p --profile)'{-p,--profile}'[AWS credentials profile to use (overrides the AWS_PROFILE environment variable)]:' \ + '(-r --region)'{-r,--region}'[AWS region]:' \ + '--timeout[maximum waiting time for any long-running operation]:' \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' +} + +function _eksctl_utils_associate-iam-oidc-provider { + _arguments \ + '--approve[Apply the changes]' \ + '(-c --cluster)'{-c,--cluster}'[EKS cluster name]:' \ + '(-f --config-file)'{-f,--config-file}'[load configuration from a file (or stdin if set to '\''-'\'')]:' \ + '(-p --profile)'{-p,--profile}'[AWS credentials profile to use (overrides the AWS_PROFILE environment variable)]:' \ + '(-r --region)'{-r,--region}'[AWS region]:' \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' +} + +function _eksctl_utils_install-vpc-controllers { + _arguments \ + '--approve[Apply the changes]' \ + '(-c --cluster)'{-c,--cluster}'[EKS cluster name]:' \ + '(-f --config-file)'{-f,--config-file}'[load configuration from a file (or stdin if set to '\''-'\'')]:' \ + '(-p --profile)'{-p,--profile}'[AWS credentials profile to use (overrides the AWS_PROFILE environment variable)]:' \ + '(-r --region)'{-r,--region}'[AWS region]:' \ + '--timeout[maximum waiting time for any long-running operation]:' \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' +} + +function _eksctl_utils_update-cluster-endpoints { + _arguments \ + '--approve[Apply the changes]' \ + '(-c --cluster)'{-c,--cluster}'[EKS cluster name]:' \ + '(-f --config-file)'{-f,--config-file}'[load configuration from a file (or stdin if set to '\''-'\'')]:' \ + '--private-access[access for private (VPC) clients]' \ + '(-p --profile)'{-p,--profile}'[AWS credentials profile to use (overrides the AWS_PROFILE environment variable)]:' \ + '--public-access[access for public clients]' \ + '(-r --region)'{-r,--region}'[AWS region]:' \ + '--timeout[maximum waiting time for any long-running operation]:' \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' +} + +function _eksctl_utils_set-public-access-cidrs { + _arguments \ + '--approve[Apply the changes]' \ + '(-c --cluster)'{-c,--cluster}'[EKS cluster name]:' \ + '(-f --config-file)'{-f,--config-file}'[load configuration from a file (or stdin if set to '\''-'\'')]:' \ + '(-p --profile)'{-p,--profile}'[AWS credentials profile to use (overrides the AWS_PROFILE environment variable)]:' \ + '(-r --region)'{-r,--region}'[AWS region]:' \ + '--timeout[maximum waiting time for any long-running operation]:' \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' +} + +function _eksctl_utils_nodegroup-health { + _arguments \ + '--cluster[EKS cluster name]:' \ + '(-f --config-file)'{-f,--config-file}'[load configuration from a file (or stdin if set to '\''-'\'')]:' \ + '(-n --name)'{-n,--name}'[Name of the nodegroup]:' \ + '(-p --profile)'{-p,--profile}'[AWS credentials profile to use (overrides the AWS_PROFILE environment variable)]:' \ + '(-r --region)'{-r,--region}'[AWS region]:' \ + '--timeout[maximum waiting time for any long-running operation]:' \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' +} + + +function _eksctl_completion { + local -a commands + + _arguments -C \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' \ + "1: :->cmnds" \ + "*::arg:->args" + + case $state in + cmnds) + commands=( + "bash:Generates bash completion scripts" + "zsh:Generates zsh completion scripts" + ) + _describe "command" commands + ;; + esac + + case "$words[1]" in + bash) + _eksctl_completion_bash + ;; + zsh) + _eksctl_completion_zsh + ;; + esac +} + +function _eksctl_completion_bash { + _arguments \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' +} + +function _eksctl_completion_zsh { + _arguments \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' +} + +function _eksctl_version { + _arguments \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' +} + +function _eksctl_help { + _arguments \ + '(-C --color)'{-C,--color}'[toggle colorized logs (valid options: true, false, fabulous)]:' \ + '(-h --help)'{-h,--help}'[help for this command]' \ + '(-v --verbose)'{-v,--verbose}'[set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging]:' +} + diff --git a/.zsh/completion/_gh.zsh b/.zsh/completion/_gh.zsh new file mode 100644 index 0000000..b872834 --- /dev/null +++ b/.zsh/completion/_gh.zsh @@ -0,0 +1,159 @@ +#compdef _gh gh + +# zsh completion for gh -*- shell-script -*- + +__gh_debug() +{ + local file="$BASH_COMP_DEBUG_FILE" + if [[ -n ${file} ]]; then + echo "$*" >> "${file}" + fi +} + +_gh() +{ + local shellCompDirectiveError=1 + local shellCompDirectiveNoSpace=2 + local shellCompDirectiveNoFileComp=4 + local shellCompDirectiveFilterFileExt=8 + local shellCompDirectiveFilterDirs=16 + + local lastParam lastChar flagPrefix requestComp out directive compCount comp lastComp + local -a completions + + __gh_debug "\n========= starting completion logic ==========" + __gh_debug "CURRENT: ${CURRENT}, words[*]: ${words[*]}" + + # The user could have moved the cursor backwards on the command-line. + # We need to trigger completion from the $CURRENT location, so we need + # to truncate the command-line ($words) up to the $CURRENT location. + # (We cannot use $CURSOR as its value does not work when a command is an alias.) + words=("${=words[1,CURRENT]}") + __gh_debug "Truncated words[*]: ${words[*]}," + + lastParam=${words[-1]} + lastChar=${lastParam[-1]} + __gh_debug "lastParam: ${lastParam}, lastChar: ${lastChar}" + + # For zsh, when completing a flag with an = (e.g., gh -n=<TAB>) + # completions must be prefixed with the flag + setopt local_options BASH_REMATCH + if [[ "${lastParam}" =~ '-.*=' ]]; then + # We are dealing with a flag with an = + flagPrefix="-P ${BASH_REMATCH}" + fi + + # Prepare the command to obtain completions + requestComp="${words[1]} __complete ${words[2,-1]}" + if [ "${lastChar}" = "" ]; then + # If the last parameter is complete (there is a space following it) + # We add an extra empty parameter so we can indicate this to the go completion code. + __gh_debug "Adding extra empty parameter" + requestComp="${requestComp} \"\"" + fi + + __gh_debug "About to call: eval ${requestComp}" + + # Use eval to handle any environment variables and such + out=$(eval ${requestComp} 2>/dev/null) + __gh_debug "completion output: ${out}" + + # Extract the directive integer following a : from the last line + local lastLine + while IFS='\n' read -r line; do + lastLine=${line} + done < <(printf "%s\n" "${out[@]}") + __gh_debug "last line: ${lastLine}" + + if [ "${lastLine[1]}" = : ]; then + directive=${lastLine[2,-1]} + # Remove the directive including the : and the newline + local suffix + (( suffix=${#lastLine}+2)) + out=${out[1,-$suffix]} + else + # There is no directive specified. Leave $out as is. + __gh_debug "No directive found. Setting do default" + directive=0 + fi + + __gh_debug "directive: ${directive}" + __gh_debug "completions: ${out}" + __gh_debug "flagPrefix: ${flagPrefix}" + + if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then + __gh_debug "Completion received error. Ignoring completions." + return + fi + + compCount=0 + while IFS='\n' read -r comp; do + if [ -n "$comp" ]; then + # If requested, completions are returned with a description. + # The description is preceded by a TAB character. + # For zsh's _describe, we need to use a : instead of a TAB. + # We first need to escape any : as part of the completion itself. + comp=${comp//:/\\:} + + local tab=$(printf '\t') + comp=${comp//$tab/:} + + ((compCount++)) + __gh_debug "Adding completion: ${comp}" + completions+=${comp} + lastComp=$comp + fi + done < <(printf "%s\n" "${out[@]}") + + if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then + # File extension filtering + local filteringCmd + filteringCmd='_files' + for filter in ${completions[@]}; do + if [ ${filter[1]} != '*' ]; then + # zsh requires a glob pattern to do file filtering + filter="\*.$filter" + fi + filteringCmd+=" -g $filter" + done + filteringCmd+=" ${flagPrefix}" + + __gh_debug "File filtering command: $filteringCmd" + _arguments '*:filename:'"$filteringCmd" + elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then + # File completion for directories only + local subDir + subdir="${completions[1]}" + if [ -n "$subdir" ]; then + __gh_debug "Listing directories in $subdir" + pushd "${subdir}" >/dev/null 2>&1 + else + __gh_debug "Listing directories in ." + fi + + _arguments '*:dirname:_files -/'" ${flagPrefix}" + if [ -n "$subdir" ]; then + popd >/dev/null 2>&1 + fi + elif [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ] && [ ${compCount} -eq 1 ]; then + __gh_debug "Activating nospace." + # We can use compadd here as there is no description when + # there is only one completion. + compadd -S '' "${lastComp}" + elif [ ${compCount} -eq 0 ]; then + if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then + __gh_debug "deactivating file completion" + else + # Perform file completion + __gh_debug "activating file completion" + _arguments '*:filename:_files'" ${flagPrefix}" + fi + else + _describe "completions" completions $(echo $flagPrefix) + fi +} + +# don't run the completion function when being source-ed or eval-ed +if [ "$funcstack[1]" = "_gh" ]; then + _gh +fi diff --git a/.zsh/completion/_go.zsh b/.zsh/completion/_go.zsh index 18bcaaf..8383150 100644 --- a/.zsh/completion/_go.zsh +++ b/.zsh/completion/_go.zsh @@ -1,160 +1,1034 @@ -# install in /etc/zsh/zshrc or your personal .zshrc - -# gc -prefixes=(5 6 8) -for p in $prefixes; do - compctl -g "*.${p}" ${p}l - compctl -g "*.go" ${p}g -done - -# standard go tools -compctl -g "*.go" gofmt - -# gccgo -compctl -g "*.go" gccgo - -# go tool -__go_tool_complete() { - typeset -a commands build_flags - commands+=( - 'build[compile packages and dependencies]' - 'clean[remove object files]' - 'doc[run godoc on package sources]' - 'env[print Go environment information]' - 'fix[run go tool fix on packages]' - 'fmt[run gofmt on package sources]' - 'get[download and install packages and dependencies]' - 'help[display help]' - 'install[compile and install packages and dependencies]' - 'list[list packages]' - 'run[compile and run Go program]' - 'test[test packages]' - 'tool[run specified go tool]' - 'version[print Go version]' - 'vet[run go tool vet on packages]' +#compdef go -P -value-,GO*,-default- -P -value-,CGO*,-default- +# ------------------------------------------------------------------------------ +# Copyright (c) 2016 Github zsh-users - http://github.com/zsh-users +# Copyright (c) 2013-2015 Robby Russell and contributors (see +# https://github.com/robbyrussell/oh-my-zsh/contributors) +# Copyright (c) 2010-2014 Go authors +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the zsh-users nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY DIRECT, +# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for go 1.14 (http://golang.org). +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Mikkel Oscar Lyderik Larsen <mikkeloscar@gmail.com> +# * Paul Seyfert <pseyfert.mathphys@gmail.com> +# * oh-my-zsh authors: +# https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/golang/golang.plugin.zsh +# * Go authors +# +# ------------------------------------------------------------------------------ + +__go_buildmodes() { + local -a buildmodes + buildmodes=( + 'archive[non-main packages into .a files]' + 'c-archive[main package, plus all packages it imports, into a C archive file]' + 'c-shared[main package, plus all packages it imports, into a C shared library]' + 'default[main packages are built into executables and listed non-main packages are built into .a files]' + 'shared[non-main packages into a single shared library that will be used when building with the -linkshared option]' + 'exe[main packages into executables]' + 'pie[main packages and everything they import into position independent executables (PIE)]' + 'plugin[main packages, plus all packages that they import, into a Go plugin]' + ) + + _values 'mode' $buildmodes +} + + +__go_runtimedebug() { + local -a vars + vars=( + 'allocfreetrace[profile allocations]:boolean:(1 0)' + 'clobberfree[clobber memory after free]:boolean:(1 0)' + 'cgocheck[check passing go pointers to non-go]: :((0\:"no checks" 1\:"check checks" 2\:"expensive checks"))' + 'efence[allocate on unique pages]:boolean:(1 0)' + "gccheckmark[verify garbage collector's concurrent mark phase]:boolean:(1 0)" + 'gcpacertrace[print state of the concurrent pacer from garbage collector]:boolean:(1 0)' + 'gcshrinkstackoff[disable moving goroutines to smaller stacks]:boolean:(1 0)' + 'gcstoptheworld[disable concurrent garbage collection]: :((0\:default 1\:"disable concurrent garbage collection" 2\:"disable concurrent gc and sweeping"))' + 'gctrace[emit memory collection and pause information from the garbage collector]:boolean:(1 0)' + 'madvdontneed[use MADV_DONTNEED instead of MADV_FREE]:boolean:(1 0)' + 'memprofilerate[every N-th allocation should be profiled]:int:' + 'invalidptr[crash on invalid integers in pointer-type variables]:boolean:(1 0)' + 'sbrk[replace memory allocator and garbage collector by trivial allocator]:boolean:(1 0)' + 'scavenge[enable debugging mode of heap scavenger]:boolean:(1 0)' + 'scavtrace[emit scavenger work information (memory returned and memory utilization)]:boolean:(1 0)' + 'scheddetail[emit detailed states of scheduler, processors, threads, goroutines]:boolean:(1 0)' + 'schedtrace[emmit scheduler state every N ms to stderr]:int' + 'tracebackancestors[set ancestor goroutines to be printed in goroutine creation stacks]:int' + 'asyncpreemptoff[disable signal-based asynchronous goroutine preemption.]:boolean:(1 0)' ) - if (( CURRENT == 2 )); then - # explain go commands - _values 'go tool commands' ${commands[@]} + _values -s ',' -S '=' "runtime debug behaviour" $vars[@] +} + +__go_gcdebugflags() { + _values -s , -S = 'debug flag' \ + 'append[print information about append compilation]' \ + 'checkptr[instrument unsafe pointer conversions]:pointer conversion checks:((0\:"instrumentation disabled" 1\:"conversions involving unsafe.Pointer are instrumented" 2\:"conversions to unsafe.Pointer force heap allocation"))' \ + 'closure[print information about closure compilation]' \ + 'compilelater[compile functions as late as possible]' \ + 'disablenil[disable nil checks]' \ + 'dclstack[run internal dclstack check]' \ + 'gcprog[print dump of GC programs]' \ + 'libfuzzer[coverage instrumentation for libfuzzer]' \ + 'nil[print information about nil checks]' \ + 'panic[do not hide any compiler panic]' \ + 'slice[print information about slice compilation]' \ + 'typeassert[print information about type assertion inlining]' \ + 'wb[print information about write barriers]' \ + 'export[print export data]' \ + 'pctab[print named pc-value table]:pc-value:(pctospadj pctofile pctoline pctoinline pctopcdata)' \ + 'locationlists[print information about DWARF location list creation]' \ + 'typecheckinl[eager typechecking of inline function bodies]' \ + 'dwarfinl[print information about DWARF inlined function creation]' \ + 'softfloat[force compiler to emit soft-float code]' \ + 'defer[print information about defer compilation]' \ + 'ssa/help[print help about SSA debugging]' +} + +__go_gcflags() { + _arguments \ + '-%[debug non-static initializers]' \ + '-c=[concurrency during compilation]:int' \ + '-+[compiling runtime]' \ + '-B[disable bounds checking]' \ + '-C[disable printing of columns in error messages]' \ + '-D=[set relative path for local imports]:path: _path_files -/' \ + '-E[debug symbol export]' \ + '-I=[add directory to import search path]:directory: _path_files -/' \ + '-K[debug missing line numbers]' \ + '-L[show full file names in error messages]' \ + '-N[disable optimizations]' \ + '-S[print assembly listing]' \ + '-V[print version and exit]' \ + '-W[debug parse tree after type checking]' \ + '-asmhdr=[write assembly header to file]:file' \ + '-bench=[append benchmark times to file]:file' \ + '-blockprofile=[write block profile to file]:file' \ + '-buildid=[record id as the build id in the export metadata]:id' \ + '-complete[compiling complete package (no C or assembly)]' \ + '-cpuprofile=[write cpu profile to file]:file' \ + '-d=[print debug information about items in list; try -d help]:list: __go_gcdebugflags' \ + '-dwarf[generate DWARF symbols (default true)]' \ + '-dwarfbasentries[use base address selection entries in DWARF (default true)]' \ + '-dwarflocationlists[add location lists to DWARF in optimized mode (default true)]' \ + '-dynlink[support references to Go symbols defined in other shared libraries]' \ + '-e[no limit on number of errors reported]' \ + '-gendwarfinl=[generate DWARF inline info records (default 2)]:int' \ + '-goversion=[required version of the runtime]:string' \ + '-h[halt on error]' \ + '-importcfg=[read import configuration from file]:file' \ + '-importmap=[add definition of the form source=actual to import map]:definition' \ + '-installsuffix=[set pkg directory suffix]:suffix' \ + '-j[debug runtime-initialized variables]' \ + '-json=[version,destination for JSON compiler/optimizer logging]:string' \ + '-l[disable inlining]' \ + '-lang=[release to compile for]:string' \ + '-linkobj=[write linker-specific object to file]:file' \ + '-linkshared[generate code that will be linked against Go shared libraries]' \ + '-live[debug liveness analysis]' \ + '-m[print optimization decisions]' \ + '-memprofile=[write memory profile to file]:file' \ + '-memprofilerate=[set runtime.MemProfileRate to rate]:rate' \ + '-msan[build code compatible with C/C++ memory sanitizer]' \ + '-mutexprofile=[write mutex profile to file]:file' \ + '-newobj[use new object file format]' \ + '-nolocalimports[reject local (relative) imports]' \ + '-o=[write output to file]:file' \ + '-p=[set expected package import path]:path: _path_files -/' \ + '-pack[write to file.a instead of file.o]' \ + '-r[debug generated wrappers]' \ + '-race[enable race detector]' \ + '-shared[generate code that can be linked into a shared library]' \ + '-smallframes[reduce the size limit for stack allocated objects]' \ + '-spectre=[enable spectre mitigations]:mitigations:(all index ret)' \ + '-std[compiling standard library]' \ + '-symabis=[read symbol ABIs from file]:file' \ + '-traceprofile=[write an execution trace to file]:file' \ + '-trimpath=[remove prefix from recorded source file paths]:prefix' \ + '-v[increase debug verbosity]' \ + '-w[debug type checking]' \ + '-wb[enable write barrier (default true)]' \ +} + + +local -a commands build_flags +commands=( +'bug:start a bug report' +'build:compile packages and dependencies' +'clean:remove object files and cached files' +'doc:show documentation for package or symbol' +'env:print Go environment information' +'fix:update packages to use new APIs' +'fmt:gofmt (reformat) package sources' +'generate:generate Go files by processing source' +'get:download and install packages and dependencies' +'install:compile and install packages and dependencies' +'list:list packages or modules' +'mod:module maintenance' +'run:compile and run Go program' +'test:test packages' +'tool:run specified go tool' +'version:print Go version' +'vet:report likely mistakes in packages' +'help:get more information about a command' +) + +__go_envvarvals() { + # if __go_envvarvals is called for -value-, I use the function argument to + # decide which variable to go to. if $1 is not set, then __go_envvarvals is + # called from the `go env` completion and the current word (with all after + # the first '=' removed) is the current variable. + local variable + variable=${1-${words[$CURRENT]%%=*}} + case $variable in + # commands + AR) + ;& + CC) + ;& + CXX) + ;& + FC) + ;& + GCCGO) + _command_names -e + ;; + # directories (using fallthrough) + GOBIN) + ;& + GOCACHE) + ;& + GOTMPDIR) + ;& + GOTOOLDIR) + ;& + GOROOT) + ;& + GOROOT_FINAL) + ;& + GCCGOTOOLDIR) + ;& + GOPATH) + ;& + GOMODCACHE) + _files -/ + ;; + # regular files (using fallthrough) + GOMOD) + ;& + PKG_CONFIG) + ;& + GOENV) + _files + ;; + # special + GOHOSTOS) + ;& + GOOS) + # from https://golang.org/doc/install/source#environment + _values 'operating system' aix android darwin dragonfly freebsd illumos js linux netbsd openbsd plan9 solaris windows + ;; + GOHOSTARCH) + ;& + GOARCH) + _values 'architecture' amd64 386 arm ppc64 + ;; + CGO_ENABLED) + _values 'enable/disable cgo' 0 1 + ;; + GO_EXTLINK_ENABLED) + _values 'enable/disable external linkage' 0 1 + ;; + GOARM) + _values 'target arm architecture' 5 6 7 + ;; + GO386) + _values 'x86 floating point instruction set' 387 sse2 + ;; + GOMIPS*) + _values 'mips floating point instructions' hardfloat softfloat + ;; + GOWASM) + _values 'web assembly features' -s ',' satconv signext + ;; + GOPROXY) + _urls + ;; + GOEXE) + _message "suffix for executables" + ;; + CGO_*FLAGS_*ALLOW) + _message "regexp" + ;; + CGO_*FLAGS) + _dispatch $service -value-,${variable#CGO_},-default- + ;; + GODEBUG) + __go_runtimedebug + ;; + GOFLAGS) + # not implemented, sorry + ;; + GOINSECURE) + ;& + GOPRIVATE) + ;& + GONOPROXY) + ;& + GONOSUMDB) + # comma separated glob patterns (in the syntax of Go's path.Match) + _message "comma separated glob pattern" + ;; + GOSUMDB) + _message "e.g. sum.golang.org+<publickey> https://sum.golang.org" + ;; + esac +} + +if [[ "$service" = -value-* ]]; then + variable=${${service%,-default-}#-value-,} + # some special variables are not read from the environment + local -a blacklist + blacklist=('GOEXE' 'GOGCCFLAGS' 'GOHOSTARCH' 'GOHOSTOS' 'GOMOD' 'GOTOOLDIR') + if (($blacklist[(I)$variable])); then return fi - build_flags=( - '-a[force reinstallation of packages that are already up-to-date]' + __go_envvarvals $variable + return +fi + +_arguments \ + "1: :{_describe 'command' commands}" \ + '*:: :->args' + +case $state in + args) + build_flags=( + '-a[force rebuilding of packages that are already up-to-date]' '-n[print the commands but do not run them]' - '-p[number of parallel builds]:number' + '-p[number of builds that can be run in parallel]:number' '-race[enable data race detection]' + '-msan[enable interoperation with memory sanitizer]' + '-v[print the names of packages as they are compiled]' + '-work[print temporary work directory and keep it]' '-x[print the commands]' - '-work[print temporary directory name and keep it]' - '-ccflags[flags for 5c/6c/8c]:flags' - '-gcflags[flags for 5g/6g/8g]:flags' - '-ldflags[flags for 5l/6l/8l]:flags' - '-gccgoflags[flags for gccgo]:flags' + '-asmflags[arguments for each go tool asm invocation]:flags' + '-buildmode[build mode to use]:mode:__go_buildmodes' '-compiler[name of compiler to use]:name' + '-gccgoflags[arguments for gccgo]:args' + '*-gcflags=[arguments for each go tool compile invocation]:args:__go_gcflags' '-installsuffix[suffix to add to package directory]:suffix' + '-ldflags[arguments to pass on each go tool link invocation.]:flags' + '-linkshared[link against shared libraries]' + '-overlay[read a JSON config file that provides an overlay for build operations]:file:_files -g "*.json"' + '-pkgdir[install and load all packages from dir]:dir' '-tags[list of build tags to consider satisfied]:tags' - ) - __go_list() { - local expl importpaths - declare -a importpaths - importpaths=($(go list ${words[$CURRENT]}... 2>/dev/null)) - _wanted importpaths expl 'import paths' compadd "$@" - "${importpaths[@]}" - } - case ${words[2]} in - clean|doc) - _arguments -s -w : '*:importpaths:__go_list' - ;; - fix|fmt|list|vet) - _alternative ':importpaths:__go_list' ':files:_path_files -g "*.go"' - ;; - install) - _arguments -s -w : ${build_flags[@]} \ - "-v[show package names]" \ - '*:importpaths:__go_list' - ;; - get) - _arguments -s -w : \ - ${build_flags[@]} - ;; - build) - _arguments -s -w : \ - ${build_flags[@]} \ - "-v[show package names]" \ - "-o[output file]:file:_files" \ - "*:args:{ _alternative ':importpaths:__go_list' ':files:_path_files -g \"*.go\"' }" - ;; - test) - _arguments -s -w : \ - ${build_flags[@]} \ - "-c[do not run, compile the test binary]" \ - "-i[do not run, install dependencies]" \ - "-v[print test output]" \ - "-x[print the commands]" \ - "-short[use short mode]" \ - "-parallel[number of parallel tests]:number" \ - "-cpu[values of GOMAXPROCS to use]:number list" \ - "-run[run tests and examples matching regexp]:regexp" \ - "-bench[run benchmarks matching regexp]:regexp" \ - "-benchmem[print memory allocation stats]" \ - "-benchtime[run each benchmark until taking this long]:duration" \ - "-blockprofile[write goroutine blocking profile to file]:file" \ - "-blockprofilerate[set sampling rate of goroutine blocking profile]:number" \ - "-timeout[kill test after that duration]:duration" \ - "-cpuprofile[write CPU profile to file]:file:_files" \ - "-memprofile[write heap profile to file]:file:_files" \ - "-memprofilerate[set heap profiling rate]:number" \ - "*:args:{ _alternative ':importpaths:__go_list' ':files:_path_files -g \"*.go\"' }" - ;; - help) - _values "${commands[@]}" \ - 'gopath[GOPATH environment variable]' \ - 'packages[description of package lists]' \ - 'remote[remote import path syntax]' \ - 'testflag[description of testing flags]' \ - 'testfunc[description of testing functions]' - ;; - run) - _arguments -s -w : \ - ${build_flags[@]} \ - '*:file:_path_files -g "*.go"' - ;; - tool) - if (( CURRENT == 3 )); then - _values "go tool" $(go tool) - return + '-trimpath[remove all file system paths from the resulting executable]' + '-toolexec[program to use to invoke toolchain programs]:args' + ) + mod_flags=( + '-mod=[module download mode to use]:download mode:(readonly vendor mod)' + '-modcacherw[leave newly-created directories in the module cache read-write]' + '-modfile=[read an alternate go.mod file]:modfile: _files -g "*.mod"' + ) + + __go_packages() { + local gopaths + declare -a gopaths + gopaths=("${(s/:/)$(go env GOPATH)}") + gopaths+=("$(go env GOROOT)") + for p in $gopaths; do + _path_files $@ -W "$p/src" -/ + done + # no special treatment for + # - relative paths starting with .. + # - absolute path starting with / + # - variables, substitutions, subshells + if [[ $words[$CURRENT] = ..* || $words[$CURRENT] = \$* || $words[$CURRENT] = /* ]]; then + _path_files $@ -/ -g '*.go' + else + # go build accepts paths relative to the cwd but they must start with './', so prefix them + _path_files $@ -P './' -/ -g '*.go' fi - case ${words[3]} in - [568]g) - _arguments -s -w : \ - '-I[search for packages in DIR]:includes:_path_files -/' \ - '-L[show full path in file:line prints]' \ - '-S[print the assembly language]' \ - '-V[print the compiler version]' \ - '-e[no limit on number of errors printed]' \ - '-h[panic on an error]' \ - '-l[disable inlining]' \ - '-m[print optimization decisions]' \ - '-o[file specify output file]:file' \ - '-p[assumed import path for this code]:importpath' \ - '-u[disable package unsafe]' \ - "*:file:_files -g '*.go'" + } + + case $words[1] in + build) + _arguments \ + '-o[force build to write to named output file or directory]:file or directory:_files' \ + '-i[installs the packages that are dependencies of the target]' \ + ${build_flags[@]} \ + ${mod_flags[@]} \ + '*:importpaths:__go_packages' + ;; + + clean) + _arguments \ + '-i[remove corresponding installed archive or binary]' \ + '-r[apply clean recursively on all dependencies]' \ + ${build_flags[@]} \ + ${mod_flags[@]} \ + '*:importpaths:__go_packages' + ;; + + doc) + _arguments \ + '-c[respect case when matching symbols]' \ + '-cmd[treat a command (package main) like a regular package]' \ + '-u[show docs for unexported and exported symbols and methods]' ;; - [568]l) - local O=${words[3]%l} - _arguments -s -w : \ - '-o[file specify output file]:file' \ - '-L[search for packages in DIR]:includes:_path_files -/' \ - "*:file:_files -g '*.[ao$O]'" + + env) + local -a goenvvars + goenvvars=( + "GOARCH[architecture, or processor, for which to compile code.]:architecture" + "GCCGO[gccgo command to run.]:gccgo command" + "GOBIN[directory where 'go install' installs to]:go install target dir" + "GOCACHE[directory to store cached information]:go build cache dir" + "GODEBUG[enable runtime debug facilities]:runtime debug settings" + "GOENV[location of the go environment configuration file]:configuration file" + "GOFLAGS[default go command line flags]:space sparated default command line flags" + "GOINSECURE[module prefixes that are feched insecurely]:comma separated module prefixes" + "GOOS[target operating system]:operating system" + "GOPATH[path to resolve import statements]:import path" + "GOPROXY[URL of go module proxy]:proxy url" + "GOROOT[root of the go tree]:go root directory" + "GOTMPDIR[directory for temporary sources, packages, and binaries]:tmp directory" + "GOPRIVATE[modules that should always be fetched directly]:comma separated glob patterns" + "GONOPROXY[modules that should always be fetched directly]:comma separated glob patterns" + "GONOSUMDB[modules that should not be compared against the checksum db]:comma separated glob patterns" + "GOMODCACHE[module cache directory]:path" + "GOSUMDB[checksum database]:name(+publickey( url))" + "AR[command for manipulating library archives (for gccgo)]:archive manipulation program" + "CC[command to compile C code]:C compiler" + "CGO_ENABLED[enable/disable cgo]:boolean" + "CGO_CFLAGS[flags passed to the compiler for C code]:C compilation flags" + "CGO_CFLAGS_ALLOW[additional flags to allow to appear in #cgo CFLAGS]:regular expression" + "CGO_CFLAGS_DISALLOW[flags that must be disallowed from appearing in #cgo CFLAGS]" + "CGO_CPPFLAGS[flags passed to the C preprocessor]:C preprocessor flags" + "CGO_CPPFLAGS_ALLOW[additional flags to allow to appear in #cgo CPPFLAGS]:regular expression" + "CGO_CPPFLAGS_DISALLOW[flags that must be disallowed from appearing in #cgo CPPFLAGS]" + "CGO_CXXFLAGS[flags passed to the compiler for C++ code]:C++ compilation flags" + "CGO_CXXFLAGS_ALLOW[additional flags to allow to appear in #cgo CXXFLAGS]:regular expression" + "CGO_CXXFLAGS_DISALLOW[flags that must be disallowed from appearing in #cgo CXXFLAGS]" + "CGO_FFLAGS[flags passed to the compiler for Fortran code]:Fortran compilation flags" + "CGO_FFLAGS_ALLOW[additional flags to allow to appear in #cgo FFLAGS]:regular expression" + "CGO_FFLAGS_DISALLOW[flags that must be disallowed from appearing in #cgo FFLAGS]" + "CGO_LDFLAGS[flags passed to the compiler for linker]:linker flags" + "CGO_LDFLAGS_ALLOW[additional flags to allow to appear in #cgo LDFLAGS]:regular expression" + "CGO_LDFLAGS_DISALLOW[flags that must be disallowed from appearing in #cgo LDFLAGS]" + "CXX[command to compile C++]:C++ compiler" + "FC[command to compile Fortran]:Fortran compiler" + "PKG_CONFIG[Path to pkg-config tool.]:path to pkg-config" + "GOARM[arm architecture]:arm architecture" + "GO386[x86 instruction set]:x86 instruction set" + "GOMIPS[mips instruction set]:mips instruction set" + "GOMIPS64[mips64 instruction set]:mips64 instruction set" + "GOWASM[web assembly features]:comma separated web assembly features" + "GCCGOTOOLDIR[directory of gccgo tools]:gccgo tool director" + "GOROOT_FINAL[root of the go tree]:go root" + "GO_EXTLINK_ENABLED[enable external linking mode]:boolean" + "GIT_ALLOW_PROTOCOL[schemes allowed to fetch]:colon separated git schemes" + "GOEXE[suffix for executables]:executable suffix" + "GOGCCFLAGS[arguments supplied to CC]:space separated arguments to CC" + "GOHOSTARCH[architecture of the toolchain binaries]:host os architecture" + "GOHOSTOS[operating system of the toolchain binaries]:host os" + "GOMOD[absolute path the the main go.mod]:abs path to main go.mod" + "GOTOOLDIR[installation directory of go tools]:tool installation directory" + ) + local -a exclude_from_w + exclude_from_w=(GOENV) + + __list_env_vars() { + # the parameter expansion strops off everything after the first [ + _values -s ' ' -w 'environment variable' ${goenvvars[@]%%\[*} + } + + # the ^ parameter expansion appends ": __go_envvarvals" to every element of goenvvars + # the :# parameter expansion removes all elements matching GOENV* + [[ $words[2] != '-w' ]] && _arguments \ + '-json[print the environment in JSON format]' \ + '-u[unset environment variables]' \ + '-w[change the default setting of environment variables]' \ + '*:[show environment variable]: __list_env_vars' || _values \ + -s ' ' -S "=" -w 'environment variable' ${^goenvvars:#GOENV*}": __go_envvarvals" + ;; + + fix) + _arguments '*:importpaths:__go_packages' + ;; + + fmt) + _arguments \ + '-n[prints commands that would be executed]' \ + '-x[prints commands as they are executed]' \ + '*:importpaths:__go_packages' ;; - dist) - _values "dist tool" banner bootstrap clean env install version + + generate) + _arguments \ + '-run=[specifies a regular expression to select directives]:regex' \ + '-x[print the commands]' \ + '-n[print the commands but do not run them]' \ + '-v[print the names of packages as they are compiled]' \ + "*:args:{ _alternative ':importpaths:__go_packages' _files }" ;; - *) - # use files by default - _files + + get) + # no mod_flags for get + _arguments \ + '-d[instructs get to stop after downloading the packages]' \ + '-f[force get -u not to verify that each package has been checked from vcs]' \ + '-fix[run the fix tool on the downloaded packages]' \ + '-insecure[permit fetching/resolving custom domains]' \ + '-t[also download the packages required to build tests]' \ + '-u[use the network to update the named packages]' \ + ${build_flags[@]} \ + '*:importpaths:__go_packages' ;; - esac - ;; - esac -} -compdef __go_tool_complete go + install) + _arguments ${build_flags[@]} \ + '*:importpaths:__go_packages' + ;; + + list) + local -a list_args + list_args=( + '-e[changes the handling of erroneous packages]' + '-f[specifies an alternate format for the list]:format' + '-json[causes package data to be printed in JSON format]' + '-compiled[set CompiledGoFiles to the Go source files presented to the compiler]' + '-deps[iterate over named packages and their dependencies]' + '-m[list modules instead of packages]' + ${build_flags[@]} + ${mod_flags[@]} + '*:importpaths:__go_packages' + ) + # -u and -versions are only available if -m is present on the commandline + if (($words[(I)-m])); then + list_args+=( + '-u[adds information about available upgrades]' + '-versions[list all known versions of modules]' + ) + fi + _arguments ${list_args[@]} + ;; + + mod) + local -a mod_commands + mod_commands=( + 'download:download modules to local cache' + 'edit:edit go.mod from tools or scripts' + 'graph:print module requirement graph' + 'init:initialize new module in current directory' + 'tidy:add missing and remove unused modules' + 'vendor:make vendored copy of dependencies' + 'verify:verify dependencies have expected content' + 'why:explain why packages or modules are needed' + 'help:get more information about a command' + ) + + _arguments \ + "1: :{_describe 'command' mod_commands}" \ + '*:: :->args' + + case $state in + args) + case $words[1] in + download) + _arguments \ + '-json[print a sequance of JSON objects to standard output]' + ;; + + edit) + _arguments \ + '-fmt[reformats the go.mod file without making other changes]' \ + "-module[change the module's path]" \ + '*-require=[add a requirement on the given module path and version]:require' \ + '*-droprequire=[drop a requirement on the given module path and version]:droprequire' \ + '*-exclude=[add an exclusion for the given module path and version]:exclude' \ + '*-dropexclude=[drop an exclusion for the given module path and version]:dropexclude' \ + '*-replace=[add a replacement of the given module path and version]:replace' \ + '*-dropreplace=[drop a replacement of the given module path and version]:dropreplace' \ + '-json[prints the final go.mod file in JSON format]' \ + '-print[prints the final go.mod in its text format]' \ + ':go.mod:_path_files -g "go.mod"' + ;; + graph) + ;; + init) + # Use go packages as module name suggestion + _arguments \ + '*:module:__go_packages' + ;; + tidy) + _arguments \ + '-v[print information about removed modules to standard error]' \ + '-e[attempt to proceed despite errors encountered while loading packages]' + ;; + vendor) + _arguments \ + '-v[print the names of vendored modules and packages to standard error]' \ + '-e[attempt to proceed despite errors encountered while loading packages]' + ;; + verify) + ;; + why) + _arguments \ + '-m[treats the arguments as a list of modules]' \ + '-vendor[exclude tests of dependencies]' \ + '*:module:__go_packages' + ;; + esac + ;; + esac + ;; + + run) + _arguments \ + ${build_flags[@]} \ + '-exec[invoke the binary using xprog]:xporg' \ + '*:importpaths:__go_packages' + ;; + + test) + if [[ $words[$CURRENT] = -test.* ]]; then + _arguments \ + '-test.bench[run only benchmarks matching regexp]:regexp' \ + '-test.benchmem[print memory allocations for benchmarks]' \ + '-test.benchtime[run each benchmark for duration d (default 1s)]:d' \ + '-test.blockprofile[write a goroutine blocking profile to file]:file:_files' \ + '-test.blockprofilerate[set blocking profile rate (see runtime.SetBlockProfileRate) (default 1)]:rate' \ + '-test.count[run tests and benchmarks n times (default 1)]:n' \ + '-test.coverprofile[write a coverage profile to file]:file:_files' \ + '-test.cpu[comma-separated list of cpu counts to run each test with]:comma-separated list' \ + '-test.cpuprofile[write a cpu profile to file]:file:_files' \ + '-test.failfast[do not start new tests after the first test failure]' \ + '-test.list[list tests, examples, and benchmarks matching regexp then exit]:regexp' \ + '-test.memprofile[write an allocation profile to file]:file:_files' \ + '-test.memprofilerate[set memory allocation profiling rate (see runtime.MemProfileRate)]:rate' \ + '-test.mutexprofile[write a mutex contention profile to the named file after execution]:string' \ + '-test.mutexprofilefraction[if >= 0, calls runtime.SetMutexProfileFraction() (default 1)]:int' \ + '-test.outputdir[write profiles to dir]:dir:_path_files -/' \ + '-test.parallel[run at most n tests in parallel (default 4)]:n' \ + '-test.run[run only tests and examples matching regexp]:regexp' \ + '-test.short[run smaller test suite to save time]' \ + '-test.testlogfile[write test action log to file (for use only by cmd/go)]:file' \ + '-test.timeout[panic test binary after duration d (default 0, timeout disabled)]:d' \ + '-test.trace[write an execution trace to file]:file' \ + '-test.v[verbose: print additional output]' + else + _arguments \ + "-c[compile but don't run test]" \ + '-i[install dependencies of the test]' \ + '-bench[run benchmarks matching the regular expression]:regexp' \ + '-benchmem[print memory allocation statistics for benchmarks]' \ + '-benchtime[run benchmarks for t rime]:t' \ + '-blockprofile[write a goroutine blocking profile to the specified file]:block' \ + '-blockprofilerate[control goroutine blocking profiles]:n' \ + '-count[run each test and benchmark n times]:n' \ + '-cover[enable coverage analysis]' \ + '-covermode[set the mode for coverage analysis]:mode:(set count atomic)' \ + '-coverpkg[apply coverage analysis in each test of listed packages]:list' \ + '-coverprofile[write a coverage profile to file]:cover' \ + '-cpu[specify a list of GOMAXPROCS values]:cpus' \ + '-cpuprofile[write a CPU profile to the specified file]:profile' \ + '-memprofile[write a memory profile to file]:mem' \ + '-memprofilerate[enable more precise memory profiles]:n' \ + '-outputdir[place output files from profiling in output dir]:dir' \ + '-parallel[allow parallel execution of test functions]:n' \ + '-run[run tests and examples matching the regular expression]:regexp' \ + '-short[tell long-running tests to shorten their run time]' \ + '-test.-[specify options for test running]:test running options:' \ + '-timeout[timeout long running tests]:t' \ + '-trace[write an execution trace to the specified file]:trace' \ + '-v[verbose output]' \ + ${build_flags[@]} \ + '-exec[run test binary using xprog]:xprog' \ + '-o[compile test binary to named file]:file:_files' \ + '*:importpaths:__go_packages' + fi + ;; + + tool) + local -a tools + tools=($(go tool)) + + _arguments \ + '-n[print command that would be executed]' \ + "1: :{_describe 'tool' tools}" \ + '*:: :->args' + + case $state in + args) + case $words[1] in + addr2line) + _files + ;; + + asm) + _arguments \ + '-D[predefined symbol with optional simple value]:value' \ + '-I[include directory]:value' \ + '-S[print assembly and machine code]' \ + '-debug[dump instructions as they are parsed]' \ + '-dynlink[support references to Go symbols]' \ + '-o[output file]:string' \ + '-shared[generate code that can be linked into a shared lib]' \ + '-trimpath[remove prefix from recorded source file paths]:string' + ;; + + callgraph) + local -a algos graphs + algos=( + 'static:static calls only' + 'cha:Class Hierarchy Analysis' + 'rta:Rapid Type Analysis' + 'pta:inclusion-based Points-To Analysis' + ) + graphs=( + 'digraph:output in digraph format' + 'graphviz:output in AT&T GraphViz (.dot) format' + ) + + _arguments \ + '-algo=[call-graph construction algorithm]:algos:{ _describe "algos" algos }' \ + "-test[include the package's tests in the analysis]" \ + '-format=[format in which each call graph edge is displayed]:graphs:{ _describe "graphs" graphs }' + ;; + + cgo) + _arguments \ + '-debug-define[print relevant #defines]' \ + '-debug-gcc[print gcc invocations]' \ + '-dynimport[if non-empty, print dynamic import data]:string' \ + '-dynlinker[record dynamic linker information]' \ + '-dynout[write -dynimport output to file]:file' \ + '-dynpackage[set Go package for -dynimport output]:string' \ + '-exportheader[where to write export header]:string' \ + '-gccgo[generate files for use with gccgo]' \ + '-gccgopkgpath[-fgo-pkgpath option used with gccgo]:string' \ + '-gccgoprefix[-fgo-prefix option used with gccgo]:string' \ + '-godefs[write Go definitions for C file to stdout]' \ + '-import_runtime_cgo[import runtime/cgo in generated code]' \ + '-import_syscall[import syscall in generated code]' \ + '-importpath[import path of package being built]:path' \ + '-objdir[object directory]:dir' + ;; + + compile) + _arguments \ + '-%[debug non-static initializers]' \ + '-+[compiling runtime]' \ + "-A[for bootstrapping, allow 'any' type]" \ + '-B[disable bounds checking]' \ + '-D[set relative path for local imports]:path' \ + '-E[debug symbol export]' \ + '-I[add directory to import search path]:directory' \ + '-K[debug missing line numbers]' \ + '-L[use full (long) path in error messages]' \ + '-M[debug move generation]' \ + '-N[disable optimizations]' \ + '-P[debug peephole optimizer]' \ + '-R[debug register optimizer]' \ + '-S[print assembly listing]' \ + '-V[print compiler version]' \ + '-W[debug parse tree after type checking]' \ + '-asmhdr[write assembly header to file]:file' \ + '-buildid[record id as the build id in the export metadata]:id' \ + '-complete[compiling complete package (no C or assembly)]' \ + '-cpuprofile[write cpu profile to file]:file' \ + '-d[print debug information about items in list]:list' \ + '-dynlink[support references to Go symbols]' \ + '-e[no limit on number of errors reported]' \ + '-f[debug stack frames]' \ + '-g[debug code generation]' \ + '-h[halt on error]' \ + '-i[debug line number stack]' \ + '-importmap[add definition of the form source=actual to import map]:definition' \ + '-installsuffix[set pkg directory suffix]:suffix' \ + '-j[debug runtime-initialized variables]' \ + '-l[disable inlining]' \ + '-largemodel[generate code that assumes a large memory model]' \ + '-live[debug liveness analysis]' \ + '-m[print optimization decisions]' \ + '-memprofile[write memory profile to file]:file' \ + '-memprofilerate[set runtime.MemProfileRate to rate]:rate' \ + '-nolocalimports[reject local (relative) imports]' \ + '-o[write output to file]:file' \ + '-p[set expected package import path]:path' \ + '-pack[write package file instead of object file]' \ + '-r[debug generated wrappers]' \ + '-race[enable race detector]' \ + '-s[warn about composite literals that can be simplified]' \ + '-shared[generate code that can be linked into a shared library]' \ + '-trimpath[remove prefix from recorded source file paths]:prefix' \ + '-u[reject unsafe code]' \ + '-v[increase debug verbosity]' \ + '-w[debug type checking]' \ + '-wb[enable write barrier (default 1)]' \ + '-x[debug lexer]' \ + '-y[debug declarations in canned imports (with -d)]' \ + '*:file:_files -g "*.go(-.)"' + ;; + + cover) + if (( CURRENT == 2 )); then + _arguments \ + '-func=[output coverage profile information for each function]:string' \ + '-html=[generate HTML representation of coverage profile]:file:_files' \ + '-mode=[coverage mode]:mode:(set count atomic)' + return + fi + + _arguments \ + '-o[file for output]:file' \ + '-var=[name of coverage variable to generate]:var' \ + '*:file:_files -g "*.go(-.)"' + ;; + + doc) + _arguments \ + '-c[respect case when matching symbols]' \ + '-cmd[treat a command (package main) like a regular package]' \ + '-u[show docs for unexported and exported symbols and methods]' \ + ;; + + fix) + _arguments \ + '-diff[display diffs instead of rewriting files]' \ + '-force[force fixes to run even if the code looks updated]:string' \ + '-r[restrict the rewrites]:string' \ + '*:files:_files' + ;; + + link) + _arguments \ + '-B[add an ELF NT_GNU_BUILD_ID note when using ELF]:note' \ + '-C[check Go calls to C code]' \ + '-D[set data segment address (default -1)]:address' \ + '-E[set entry symbol name]:entry' \ + '-H[set header type]:type' \ + '-I[use linker as ELF dynamic linker]:linker' \ + '-L[add specified directory to library path]:directory' \ + '-R[set address rounding quantum (default -1)]:quantum' \ + '-T[set text segment address (default -1)]:address' \ + '-V[print version and exit]' \ + '-W[disassemble input]' \ + '-X[add string value definition]:definition' \ + '-a[disassemble output]' \ + '-buildid[record id as Go toolchain build id]:id' \ + '-buildmode[set build mode]:mode' \ + '-c[dump call graph]' \ + '-cpuprofile[write cpu profile to file]:file' \ + '-d[disable dynamic executable]' \ + '-extld[use linker when linking in external mode]:linker' \ + '-extldflags[pass flags to external linker]:flags' \ + '-f[ignore version mismatch]' \ + '-g[disable go package data checks]' \ + '-h[halt on error]' \ + '-installsuffix[set package directory suffix]:suffix' \ + '-k[set field tracking symbol]:symbol' \ + '-linkmode[set link mode]:mode:(internal external auto)' \ + '-linkshared[link against installed Go shared libraries]' \ + '-memprofile[write memory profile to file]:file' \ + '-memprofilerate[set runtime.MemProfileRate to rate]:rate' \ + '-n[dump symbol table]' \ + '-o[write output to file]:file' \ + '-r[set the ELF dynamic linker search path to dir1:dir2:...]:path' \ + '-race[enable race detector]' \ + '-s[disable symbol table]' \ + '-shared[generate shared object (implies -linkmode external)]' \ + '-tmpdir[use directory for temporary files]:directory' \ + '-u[reject unsafe packages]' \ + '-v[print link trace]' \ + '-w[disable DWARF generation]' \ + '*:files:_files' + ;; + + objdump) + _arguments \ + '-s[only dump symbols matching this regexp]:regexp' \ + '*:files:_files' + ;; + + pack) + _arguments '1:ops:(c p r t x)' '::verbose:(v)' ':files:_files' + ;; + + pprof) + _arguments \ + '-callgrind[outputs a graph in callgrind format]' \ + '-disasm=[output annotated assembly]:p' \ + '-dot[outputs a graph in DOT format]' \ + '-eog[visualize graph through eog]' \ + '-evince[visualize graph through evince]' \ + '-gif[outputs a graph image in GIF format]' \ + '-gv[visualize graph through gv]' \ + '-list=[output annotated source for functions matching regexp]:p' \ + '-pdf[outputs a graph in PDF format]' \ + '-peek=[output callers/callees of functions matching regexp]:p' \ + '-png[outputs a graph image in PNG format]' \ + '-proto[outputs the profile in compressed protobuf format]' \ + '-ps[outputs a graph in PS format]' \ + '-raw[outputs a text representation of the raw profile]' \ + '-svg[outputs a graph in SVG format]' \ + '-tags[outputs all tags in the profile]' \ + '-text[outputs top entries in text form]' \ + '-top[outputs top entries in text form]' \ + '-tree[outputs a text rendering of call graph]' \ + '-web[visualize graph through web browser]' \ + '-weblist=[output annotated source in HTML]:p' \ + '-output=[generate output on file f (stdout by default)]:f' \ + '-functions[report at function level (default)]' \ + '-files[report at source file level]' \ + '-lines[report at source line level]' \ + '-addresses[report at address level]' \ + '-base[show delta from this profile]:profile' \ + '-drop_negative[ignore negative differences]' \ + '-cum[sort by cumulative data]' \ + '-seconds=[length of time for dynamic profiles]:n' \ + '-nodecount=[max number of nodes to show]:n' \ + '-nodefraction=[hide nodes below <f>*total]:f' \ + '-edgefraction=[hide edges below <f>*total]:f' \ + '-sample_index[index of sample value to display]' \ + '-mean[average sample value over first value]' \ + '-inuse_space[display in-use memory size]' \ + '-inuse_objects[display in-use object counts]' \ + '-alloc_space[display allocated memory size]' \ + '-alloc_objects[display allocated object counts]' \ + '-total_delay[display total delay at each region]' \ + '-contentions[display number of delays at each region]' \ + '-mean_delay[display mean delay at each region]' \ + '-runtime[show runtime call frames in memory profiles]' \ + '-focus=[restricts to paths going through a node matching regexp]:r' \ + '-ignore=[skips paths going through any nodes matching regexp]:r' \ + '-tagfocus=[restrict to samples tagged with key:value matching regexp]:r' \ + '-tagignore=[discard samples tagged with key:value matching regexp]' \ + '-call_tree[generate a context-sensitive call tree]' \ + '-unit=[convert all samples to unit u for display]:u' \ + '-divide_by=[scale all samples by dividing them by f]:f' \ + '-buildid=[override build id for main binary in profile]:id' \ + '-tools=[search path for object-level tools]:path' \ + '-help[help message]' \ + '*:files:_files' + ;; + + trace) + _arguments \ + '-http=[HTTP service address]:addr' \ + '*:files:_files' + ;; + + vet) + _arguments \ + '-all[check everything]' \ + '-asmdecl[check assembly against Go declarations]' \ + '-assign[check for useless assignments]' \ + '-atomic[check for common mistaken usages of the sync/atomic]' \ + '-bool[check for mistakes involving boolean operators]' \ + '-buildtags[check that +build tags are valid]' \ + '-composites[check that composite literals used field-keyed elements]' \ + '-compositewhitelist[use composite white list]' \ + '-copylocks[check that locks are not passed by value]' \ + '-methods[check that canonically named methods are canonically defined]' \ + '-nilfunc[check for comparisons between functions and nil]' \ + '-printf[check printf-like invocations]' \ + '-printfuncs[print function names to check]:string' \ + '-rangeloops[check that range loop variables are used correctly]' \ + '-shadow[check for shadowed variables]' \ + '-shadowstrict[whether to be strict about shadowing]' \ + '-shift[check for useless shifts]' \ + '-structtags[check that struct field tags have canonical format]' \ + '-tags[list of build tags to apply when parsing]:list' \ + '-test[for testing only: sets -all and -shadow]' \ + '-unreachable[check for unreachable code]' \ + '-unsafeptr[check for misuse of unsafe.Pointer]' \ + '-unusedfuncs[list of functions whose results must be used]:string' \ + '-unusedresult[check for unused result of calls to functions in -unusedfuncs]' \ + '-unusedstringmethods[list of methods whose results must be used]:string' \ + '-v[verbose]' \ + '*:files:_files' + ;; + + yacc) + _arguments \ + '-o[output]:output' \ + '-v[parsetable]:parsetable' \ + '*:files:_files' + ;; + esac + ;; + esac + ;; + + vet) + _arguments \ + '-n[print commands that would be executed]' \ + '-x[prints commands as they are executed]' \ + ${build_flags[@]} \ + '*:importpaths:__go_packages' + ;; + help) + local -a topics + topics=( + 'buildmode:build modes' + 'c:calling between Go and C' + 'cache:build and test caching' + 'environment:environment variables' + 'filetype:file types' + 'go.mod:the go.mod file' + 'gopath:GOPATH environment variable' + 'gopath-get:legacy GOPATH go get' + 'goproxy:module proxy protocol' + 'importpath:import path syntax' + 'modules:modules, module versions, and more' + 'module-get:module-aware go get' + 'module-auth:module authentication using go.sum' + 'module-private:module configuration for non-public modules' + 'packages:package lists and patterns' + 'testflag:testing flags' + 'testfunc:testing functions' + ) + + _arguments "1: :{_describe 'command' commands -- topics}" + ;; + esac + ;; +esac + +# Local Variables: +# mode: Shell-Script +# sh-indentation: 2 +# indent-tabs-mode: nil +# sh-basic-offset: 2 +# End: +# vim: ft=zsh sw=2 ts=2 et diff --git a/.zsh/completion/_hubble.zsh b/.zsh/completion/_hubble.zsh new file mode 100644 index 0000000..4e54372 --- /dev/null +++ b/.zsh/completion/_hubble.zsh @@ -0,0 +1,159 @@ +#compdef _hubble hubble + +# zsh completion for hubble -*- shell-script -*- + +__hubble_debug() +{ + local file="$BASH_COMP_DEBUG_FILE" + if [[ -n ${file} ]]; then + echo "$*" >> "${file}" + fi +} + +_hubble() +{ + local shellCompDirectiveError=1 + local shellCompDirectiveNoSpace=2 + local shellCompDirectiveNoFileComp=4 + local shellCompDirectiveFilterFileExt=8 + local shellCompDirectiveFilterDirs=16 + + local lastParam lastChar flagPrefix requestComp out directive compCount comp lastComp + local -a completions + + __hubble_debug "\n========= starting completion logic ==========" + __hubble_debug "CURRENT: ${CURRENT}, words[*]: ${words[*]}" + + # The user could have moved the cursor backwards on the command-line. + # We need to trigger completion from the $CURRENT location, so we need + # to truncate the command-line ($words) up to the $CURRENT location. + # (We cannot use $CURSOR as its value does not work when a command is an alias.) + words=("${=words[1,CURRENT]}") + __hubble_debug "Truncated words[*]: ${words[*]}," + + lastParam=${words[-1]} + lastChar=${lastParam[-1]} + __hubble_debug "lastParam: ${lastParam}, lastChar: ${lastChar}" + + # For zsh, when completing a flag with an = (e.g., hubble -n=<TAB>) + # completions must be prefixed with the flag + setopt local_options BASH_REMATCH + if [[ "${lastParam}" =~ '-.*=' ]]; then + # We are dealing with a flag with an = + flagPrefix="-P ${BASH_REMATCH}" + fi + + # Prepare the command to obtain completions + requestComp="${words[1]} __complete ${words[2,-1]}" + if [ "${lastChar}" = "" ]; then + # If the last parameter is complete (there is a space following it) + # We add an extra empty parameter so we can indicate this to the go completion code. + __hubble_debug "Adding extra empty parameter" + requestComp="${requestComp} \"\"" + fi + + __hubble_debug "About to call: eval ${requestComp}" + + # Use eval to handle any environment variables and such + out=$(eval ${requestComp} 2>/dev/null) + __hubble_debug "completion output: ${out}" + + # Extract the directive integer following a : from the last line + local lastLine + while IFS='\n' read -r line; do + lastLine=${line} + done < <(printf "%s\n" "${out[@]}") + __hubble_debug "last line: ${lastLine}" + + if [ "${lastLine[1]}" = : ]; then + directive=${lastLine[2,-1]} + # Remove the directive including the : and the newline + local suffix + (( suffix=${#lastLine}+2)) + out=${out[1,-$suffix]} + else + # There is no directive specified. Leave $out as is. + __hubble_debug "No directive found. Setting do default" + directive=0 + fi + + __hubble_debug "directive: ${directive}" + __hubble_debug "completions: ${out}" + __hubble_debug "flagPrefix: ${flagPrefix}" + + if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then + __hubble_debug "Completion received error. Ignoring completions." + return + fi + + compCount=0 + while IFS='\n' read -r comp; do + if [ -n "$comp" ]; then + # If requested, completions are returned with a description. + # The description is preceded by a TAB character. + # For zsh's _describe, we need to use a : instead of a TAB. + # We first need to escape any : as part of the completion itself. + comp=${comp//:/\\:} + + local tab=$(printf '\t') + comp=${comp//$tab/:} + + ((compCount++)) + __hubble_debug "Adding completion: ${comp}" + completions+=${comp} + lastComp=$comp + fi + done < <(printf "%s\n" "${out[@]}") + + if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then + # File extension filtering + local filteringCmd + filteringCmd='_files' + for filter in ${completions[@]}; do + if [ ${filter[1]} != '*' ]; then + # zsh requires a glob pattern to do file filtering + filter="\*.$filter" + fi + filteringCmd+=" -g $filter" + done + filteringCmd+=" ${flagPrefix}" + + __hubble_debug "File filtering command: $filteringCmd" + _arguments '*:filename:'"$filteringCmd" + elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then + # File completion for directories only + local subDir + subdir="${completions[1]}" + if [ -n "$subdir" ]; then + __hubble_debug "Listing directories in $subdir" + pushd "${subdir}" >/dev/null 2>&1 + else + __hubble_debug "Listing directories in ." + fi + + _arguments '*:dirname:_files -/'" ${flagPrefix}" + if [ -n "$subdir" ]; then + popd >/dev/null 2>&1 + fi + elif [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ] && [ ${compCount} -eq 1 ]; then + __hubble_debug "Activating nospace." + # We can use compadd here as there is no description when + # there is only one completion. + compadd -S '' "${lastComp}" + elif [ ${compCount} -eq 0 ]; then + if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then + __hubble_debug "deactivating file completion" + else + # Perform file completion + __hubble_debug "activating file completion" + _arguments '*:filename:_files'" ${flagPrefix}" + fi + else + _describe "completions" completions $(echo $flagPrefix) + fi +} + +# don't run the completion function when being source-ed or eval-ed +if [ "$funcstack[1]" = "_hubble" ]; then + _hubble +fi diff --git a/.zsh/completion/_kubectl.zsh b/.zsh/completion/_kubectl.zsh new file mode 100644 index 0000000..2ac32d5 --- /dev/null +++ b/.zsh/completion/_kubectl.zsh @@ -0,0 +1,12833 @@ +#compdef kubectl + +# Copyright 2016 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +__kubectl_bash_source() { + alias shopt=':' + alias _expand=_bash_expand + alias _complete=_bash_comp + emulate -L sh + setopt kshglob noshglob braceexpand + + source "$@" +} + +__kubectl_type() { + # -t is not supported by zsh + if [ "$1" == "-t" ]; then + shift + + # fake Bash 4 to disable "complete -o nospace". Instead + # "compopt +-o nospace" is used in the code to toggle trailing + # spaces. We don't support that, but leave trailing spaces on + # all the time + if [ "$1" = "__kubectl_compopt" ]; then + echo builtin + return 0 + fi + fi + type "$@" +} + +__kubectl_compgen() { + local completions w + completions=( $(compgen "$@") ) || return $? + + # filter by given word as prefix + while [[ "$1" = -* && "$1" != -- ]]; do + shift + shift + done + if [[ "$1" == -- ]]; then + shift + fi + for w in "${completions[@]}"; do + if [[ "${w}" = "$1"* ]]; then + echo "${w}" + fi + done +} + +__kubectl_compopt() { + true # don't do anything. Not supported by bashcompinit in zsh +} + +__kubectl_ltrim_colon_completions() +{ + if [[ "$1" == *:* && "$COMP_WORDBREAKS" == *:* ]]; then + # Remove colon-word prefix from COMPREPLY items + local colon_word=${1%${1##*:}} + local i=${#COMPREPLY[*]} + while [[ $((--i)) -ge 0 ]]; do + COMPREPLY[$i]=${COMPREPLY[$i]#"$colon_word"} + done + fi +} + +__kubectl_get_comp_words_by_ref() { + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[${COMP_CWORD}-1]}" + words=("${COMP_WORDS[@]}") + cword=("${COMP_CWORD[@]}") +} + +__kubectl_filedir() { + local RET OLD_IFS w qw + + __kubectl_debug "_filedir $@ cur=$cur" + if [[ "$1" = \~* ]]; then + # somehow does not work. Maybe, zsh does not call this at all + eval echo "$1" + return 0 + fi + + OLD_IFS="$IFS" + IFS=$'\n' + if [ "$1" = "-d" ]; then + shift + RET=( $(compgen -d) ) + else + RET=( $(compgen -f) ) + fi + IFS="$OLD_IFS" + + IFS="," __kubectl_debug "RET=${RET[@]} len=${#RET[@]}" + + for w in ${RET[@]}; do + if [[ ! "${w}" = "${cur}"* ]]; then + continue + fi + if eval "[[ \"\${w}\" = *.$1 || -d \"\${w}\" ]]"; then + qw="$(__kubectl_quote "${w}")" + if [ -d "${w}" ]; then + COMPREPLY+=("${qw}/") + else + COMPREPLY+=("${qw}") + fi + fi + done +} + +__kubectl_quote() { + if [[ $1 == \'* || $1 == \"* ]]; then + # Leave out first character + printf %q "${1:1}" + else + printf %q "$1" + fi +} + +autoload -U +X bashcompinit && bashcompinit + +# use word boundary patterns for BSD or GNU sed +LWORD='[[:<:]]' +RWORD='[[:>:]]' +if sed --help 2>&1 | grep -q GNU; then + LWORD='\<' + RWORD='\>' +fi + +__kubectl_convert_bash_to_zsh() { + sed \ + -e 's/declare -F/whence -w/' \ + -e 's/_get_comp_words_by_ref "\$@"/_get_comp_words_by_ref "\$*"/' \ + -e 's/local \([a-zA-Z0-9_]*\)=/local \1; \1=/' \ + -e 's/flags+=("\(--.*\)=")/flags+=("\1"); two_word_flags+=("\1")/' \ + -e 's/must_have_one_flag+=("\(--.*\)=")/must_have_one_flag+=("\1")/' \ + -e "s/${LWORD}_filedir${RWORD}/__kubectl_filedir/g" \ + -e "s/${LWORD}_get_comp_words_by_ref${RWORD}/__kubectl_get_comp_words_by_ref/g" \ + -e "s/${LWORD}__ltrim_colon_completions${RWORD}/__kubectl_ltrim_colon_completions/g" \ + -e "s/${LWORD}compgen${RWORD}/__kubectl_compgen/g" \ + -e "s/${LWORD}compopt${RWORD}/__kubectl_compopt/g" \ + -e "s/${LWORD}declare${RWORD}/builtin declare/g" \ + -e "s/\\\$(type${RWORD}/\$(__kubectl_type/g" \ + <<'BASH_COMPLETION_EOF' +# bash completion for kubectl -*- shell-script -*- + +__kubectl_debug() +{ + if [[ -n ${BASH_COMP_DEBUG_FILE} ]]; then + echo "$*" >> "${BASH_COMP_DEBUG_FILE}" + fi +} + +# Homebrew on Macs have version 1.3 of bash-completion which doesn't include +# _init_completion. This is a very minimal version of that function. +__kubectl_init_completion() +{ + COMPREPLY=() + _get_comp_words_by_ref "$@" cur prev words cword +} + +__kubectl_index_of_word() +{ + local w word=$1 + shift + index=0 + for w in "$@"; do + [[ $w = "$word" ]] && return + index=$((index+1)) + done + index=-1 +} + +__kubectl_contains_word() +{ + local w word=$1; shift + for w in "$@"; do + [[ $w = "$word" ]] && return + done + return 1 +} + +__kubectl_handle_reply() +{ + __kubectl_debug "${FUNCNAME[0]}" + case $cur in + -*) + if [[ $(type -t compopt) = "builtin" ]]; then + compopt -o nospace + fi + local allflags + if [ ${#must_have_one_flag[@]} -ne 0 ]; then + allflags=("${must_have_one_flag[@]}") + else + allflags=("${flags[*]} ${two_word_flags[*]}") + fi + COMPREPLY=( $(compgen -W "${allflags[*]}" -- "$cur") ) + if [[ $(type -t compopt) = "builtin" ]]; then + [[ "${COMPREPLY[0]}" == *= ]] || compopt +o nospace + fi + + # complete after --flag=abc + if [[ $cur == *=* ]]; then + if [[ $(type -t compopt) = "builtin" ]]; then + compopt +o nospace + fi + + local index flag + flag="${cur%=*}" + __kubectl_index_of_word "${flag}" "${flags_with_completion[@]}" + COMPREPLY=() + if [[ ${index} -ge 0 ]]; then + PREFIX="" + cur="${cur#*=}" + ${flags_completion[${index}]} + if [ -n "${ZSH_VERSION}" ]; then + # zsh completion needs --flag= prefix + eval "COMPREPLY=( \"\${COMPREPLY[@]/#/${flag}=}\" )" + fi + fi + fi + return 0; + ;; + esac + + # check if we are handling a flag with special work handling + local index + __kubectl_index_of_word "${prev}" "${flags_with_completion[@]}" + if [[ ${index} -ge 0 ]]; then + ${flags_completion[${index}]} + return + fi + + # we are parsing a flag and don't have a special handler, no completion + if [[ ${cur} != "${words[cword]}" ]]; then + return + fi + + local completions + completions=("${commands[@]}") + if [[ ${#must_have_one_noun[@]} -ne 0 ]]; then + completions=("${must_have_one_noun[@]}") + fi + if [[ ${#must_have_one_flag[@]} -ne 0 ]]; then + completions+=("${must_have_one_flag[@]}") + fi + COMPREPLY=( $(compgen -W "${completions[*]}" -- "$cur") ) + + if [[ ${#COMPREPLY[@]} -eq 0 && ${#noun_aliases[@]} -gt 0 && ${#must_have_one_noun[@]} -ne 0 ]]; then + COMPREPLY=( $(compgen -W "${noun_aliases[*]}" -- "$cur") ) + fi + + if [[ ${#COMPREPLY[@]} -eq 0 ]]; then + if declare -F __kubectl_custom_func >/dev/null; then + # try command name qualified custom func + __kubectl_custom_func + else + # otherwise fall back to unqualified for compatibility + declare -F __custom_func >/dev/null && __custom_func + fi + fi + + # available in bash-completion >= 2, not always present on macOS + if declare -F __ltrim_colon_completions >/dev/null; then + __ltrim_colon_completions "$cur" + fi + + # If there is only 1 completion and it is a flag with an = it will be completed + # but we don't want a space after the = + if [[ "${#COMPREPLY[@]}" -eq "1" ]] && [[ $(type -t compopt) = "builtin" ]] && [[ "${COMPREPLY[0]}" == --*= ]]; then + compopt -o nospace + fi +} + +# The arguments should be in the form "ext1|ext2|extn" +__kubectl_handle_filename_extension_flag() +{ + local ext="$1" + _filedir "@(${ext})" +} + +__kubectl_handle_subdirs_in_dir_flag() +{ + local dir="$1" + pushd "${dir}" >/dev/null 2>&1 && _filedir -d && popd >/dev/null 2>&1 +} + +__kubectl_handle_flag() +{ + __kubectl_debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}" + + # if a command required a flag, and we found it, unset must_have_one_flag() + local flagname=${words[c]} + local flagvalue + # if the word contained an = + if [[ ${words[c]} == *"="* ]]; then + flagvalue=${flagname#*=} # take in as flagvalue after the = + flagname=${flagname%=*} # strip everything after the = + flagname="${flagname}=" # but put the = back + fi + __kubectl_debug "${FUNCNAME[0]}: looking for ${flagname}" + if __kubectl_contains_word "${flagname}" "${must_have_one_flag[@]}"; then + must_have_one_flag=() + fi + + # if you set a flag which only applies to this command, don't show subcommands + if __kubectl_contains_word "${flagname}" "${local_nonpersistent_flags[@]}"; then + commands=() + fi + + # keep flag value with flagname as flaghash + # flaghash variable is an associative array which is only supported in bash > 3. + if [[ -z "${BASH_VERSION}" || "${BASH_VERSINFO[0]}" -gt 3 ]]; then + if [ -n "${flagvalue}" ] ; then + flaghash[${flagname}]=${flagvalue} + elif [ -n "${words[ $((c+1)) ]}" ] ; then + flaghash[${flagname}]=${words[ $((c+1)) ]} + else + flaghash[${flagname}]="true" # pad "true" for bool flag + fi + fi + + # skip the argument to a two word flag + if [[ ${words[c]} != *"="* ]] && __kubectl_contains_word "${words[c]}" "${two_word_flags[@]}"; then + __kubectl_debug "${FUNCNAME[0]}: found a flag ${words[c]}, skip the next argument" + c=$((c+1)) + # if we are looking for a flags value, don't show commands + if [[ $c -eq $cword ]]; then + commands=() + fi + fi + + c=$((c+1)) + +} + +__kubectl_handle_noun() +{ + __kubectl_debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}" + + if __kubectl_contains_word "${words[c]}" "${must_have_one_noun[@]}"; then + must_have_one_noun=() + elif __kubectl_contains_word "${words[c]}" "${noun_aliases[@]}"; then + must_have_one_noun=() + fi + + nouns+=("${words[c]}") + c=$((c+1)) +} + +__kubectl_handle_command() +{ + __kubectl_debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}" + + local next_command + if [[ -n ${last_command} ]]; then + next_command="_${last_command}_${words[c]//:/__}" + else + if [[ $c -eq 0 ]]; then + next_command="_kubectl_root_command" + else + next_command="_${words[c]//:/__}" + fi + fi + c=$((c+1)) + __kubectl_debug "${FUNCNAME[0]}: looking for ${next_command}" + declare -F "$next_command" >/dev/null && $next_command +} + +__kubectl_handle_word() +{ + if [[ $c -ge $cword ]]; then + __kubectl_handle_reply + return + fi + __kubectl_debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}" + if [[ "${words[c]}" == -* ]]; then + __kubectl_handle_flag + elif __kubectl_contains_word "${words[c]}" "${commands[@]}"; then + __kubectl_handle_command + elif [[ $c -eq 0 ]]; then + __kubectl_handle_command + elif __kubectl_contains_word "${words[c]}" "${command_aliases[@]}"; then + # aliashash variable is an associative array which is only supported in bash > 3. + if [[ -z "${BASH_VERSION}" || "${BASH_VERSINFO[0]}" -gt 3 ]]; then + words[c]=${aliashash[${words[c]}]} + __kubectl_handle_command + else + __kubectl_handle_noun + fi + else + __kubectl_handle_noun + fi + __kubectl_handle_word +} + +# call kubectl get $1, +__kubectl_debug_out() +{ + local cmd="$1" + __kubectl_debug "${FUNCNAME[1]}: get completion by ${cmd}" + eval "${cmd} 2>/dev/null" +} + +__kubectl_override_flag_list=(--kubeconfig --cluster --user --context --namespace --server -n -s) +__kubectl_override_flags() +{ + local ${__kubectl_override_flag_list[*]##*-} two_word_of of var + for w in "${words[@]}"; do + if [ -n "${two_word_of}" ]; then + eval "${two_word_of##*-}=\"${two_word_of}=\${w}\"" + two_word_of= + continue + fi + for of in "${__kubectl_override_flag_list[@]}"; do + case "${w}" in + ${of}=*) + eval "${of##*-}=\"${w}\"" + ;; + ${of}) + two_word_of="${of}" + ;; + esac + done + done + for var in "${__kubectl_override_flag_list[@]##*-}"; do + if eval "test -n \"\$${var}\""; then + eval "echo -n \${${var}}' '" + fi + done +} + +__kubectl_config_get_contexts() +{ + __kubectl_parse_config "contexts" +} + +__kubectl_config_get_clusters() +{ + __kubectl_parse_config "clusters" +} + +__kubectl_config_get_users() +{ + __kubectl_parse_config "users" +} + +# $1 has to be "contexts", "clusters" or "users" +__kubectl_parse_config() +{ + local template kubectl_out + template="{{ range .$1 }}{{ .name }} {{ end }}" + if kubectl_out=$(__kubectl_debug_out "kubectl config $(__kubectl_override_flags) -o template --template=\"${template}\" view"); then + COMPREPLY=( $( compgen -W "${kubectl_out[*]}" -- "$cur" ) ) + fi +} + +# $1 is the name of resource (required) +# $2 is template string for kubectl get (optional) +__kubectl_parse_get() +{ + local template + template="${2:-"{{ range .items }}{{ .metadata.name }} {{ end }}"}" + local kubectl_out + if kubectl_out=$(__kubectl_debug_out "kubectl get $(__kubectl_override_flags) -o template --template=\"${template}\" \"$1\""); then + COMPREPLY+=( $( compgen -W "${kubectl_out[*]}" -- "$cur" ) ) + fi +} + +__kubectl_get_resource() +{ + if [[ ${#nouns[@]} -eq 0 ]]; then + local kubectl_out + if kubectl_out=$(__kubectl_debug_out "kubectl api-resources $(__kubectl_override_flags) -o name --cached --request-timeout=5s --verbs=get"); then + COMPREPLY=( $( compgen -W "${kubectl_out[*]}" -- "$cur" ) ) + return 0 + fi + return 1 + fi + __kubectl_parse_get "${nouns[${#nouns[@]} -1]}" +} + +__kubectl_get_resource_namespace() +{ + __kubectl_parse_get "namespace" +} + +__kubectl_get_resource_pod() +{ + __kubectl_parse_get "pod" +} + +__kubectl_get_resource_rc() +{ + __kubectl_parse_get "rc" +} + +__kubectl_get_resource_node() +{ + __kubectl_parse_get "node" +} + +__kubectl_get_resource_clusterrole() +{ + __kubectl_parse_get "clusterrole" +} + +# $1 is the name of the pod we want to get the list of containers inside +__kubectl_get_containers() +{ + local template + template="{{ range .spec.initContainers }}{{ .name }} {{end}}{{ range .spec.containers }}{{ .name }} {{ end }}" + __kubectl_debug "${FUNCNAME} nouns are ${nouns[*]}" + + local len="${#nouns[@]}" + if [[ ${len} -ne 1 ]]; then + return + fi + local last=${nouns[${len} -1]} + local kubectl_out + if kubectl_out=$(__kubectl_debug_out "kubectl get $(__kubectl_override_flags) -o template --template=\"${template}\" pods \"${last}\""); then + COMPREPLY=( $( compgen -W "${kubectl_out[*]}" -- "$cur" ) ) + fi +} + +# Require both a pod and a container to be specified +__kubectl_require_pod_and_container() +{ + if [[ ${#nouns[@]} -eq 0 ]]; then + __kubectl_parse_get pods + return 0 + fi; + __kubectl_get_containers + return 0 +} + +__kubectl_cp() +{ + if [[ $(type -t compopt) = "builtin" ]]; then + compopt -o nospace + fi + + case "$cur" in + /*|[.~]*) # looks like a path + return + ;; + *:*) # TODO: complete remote files in the pod + return + ;; + */*) # complete <namespace>/<pod> + local template namespace kubectl_out + template="{{ range .items }}{{ .metadata.namespace }}/{{ .metadata.name }}: {{ end }}" + namespace="${cur%%/*}" + if kubectl_out=$(__kubectl_debug_out "kubectl get $(__kubectl_override_flags) --namespace \"${namespace}\" -o template --template=\"${template}\" pods"); then + COMPREPLY=( $(compgen -W "${kubectl_out[*]}" -- "${cur}") ) + fi + return + ;; + *) # complete namespaces, pods, and filedirs + __kubectl_parse_get "namespace" "{{ range .items }}{{ .metadata.name }}/ {{ end }}" + __kubectl_parse_get "pod" "{{ range .items }}{{ .metadata.name }}: {{ end }}" + _filedir + ;; + esac +} + +__kubectl_custom_func() { + case ${last_command} in + kubectl_get | kubectl_describe | kubectl_delete | kubectl_label | kubectl_edit | kubectl_patch |\ + kubectl_annotate | kubectl_expose | kubectl_scale | kubectl_autoscale | kubectl_taint | kubectl_rollout_* |\ + kubectl_apply_edit-last-applied | kubectl_apply_view-last-applied) + __kubectl_get_resource + return + ;; + kubectl_logs) + __kubectl_require_pod_and_container + return + ;; + kubectl_exec | kubectl_port-forward | kubectl_top_pod | kubectl_attach) + __kubectl_get_resource_pod + return + ;; + kubectl_cordon | kubectl_uncordon | kubectl_drain | kubectl_top_node) + __kubectl_get_resource_node + return + ;; + kubectl_config_use-context | kubectl_config_rename-context) + __kubectl_config_get_contexts + return + ;; + kubectl_config_delete-cluster) + __kubectl_config_get_clusters + return + ;; + kubectl_cp) + __kubectl_cp + return + ;; + *) + ;; + esac +} + +_kubectl_alpha_debug() +{ + last_command="kubectl_alpha_debug" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--arguments-only") + local_nonpersistent_flags+=("--arguments-only") + flags+=("--attach") + local_nonpersistent_flags+=("--attach") + flags+=("--container=") + two_word_flags+=("--container") + local_nonpersistent_flags+=("--container=") + flags+=("--env=") + two_word_flags+=("--env") + local_nonpersistent_flags+=("--env=") + flags+=("--image=") + two_word_flags+=("--image") + local_nonpersistent_flags+=("--image=") + flags+=("--image-pull-policy=") + two_word_flags+=("--image-pull-policy") + local_nonpersistent_flags+=("--image-pull-policy=") + flags+=("--quiet") + local_nonpersistent_flags+=("--quiet") + flags+=("--stdin") + flags+=("-i") + local_nonpersistent_flags+=("--stdin") + flags+=("--target=") + two_word_flags+=("--target") + local_nonpersistent_flags+=("--target=") + flags+=("--tty") + flags+=("-t") + local_nonpersistent_flags+=("--tty") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_flag+=("--image=") + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_alpha() +{ + last_command="kubectl_alpha" + + command_aliases=() + + commands=() + commands+=("debug") + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_annotate() +{ + last_command="kubectl_annotate" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--all") + local_nonpersistent_flags+=("--all") + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--dry-run") + local_nonpersistent_flags+=("--dry-run") + flags+=("--field-selector=") + two_word_flags+=("--field-selector") + local_nonpersistent_flags+=("--field-selector=") + flags+=("--filename=") + two_word_flags+=("--filename") + flags_with_completion+=("--filename") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + local_nonpersistent_flags+=("--filename=") + flags+=("--kustomize=") + two_word_flags+=("--kustomize") + two_word_flags+=("-k") + local_nonpersistent_flags+=("--kustomize=") + flags+=("--local") + local_nonpersistent_flags+=("--local") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--overwrite") + local_nonpersistent_flags+=("--overwrite") + flags+=("--record") + local_nonpersistent_flags+=("--record") + flags+=("--recursive") + flags+=("-R") + local_nonpersistent_flags+=("--recursive") + flags+=("--resource-version=") + two_word_flags+=("--resource-version") + local_nonpersistent_flags+=("--resource-version=") + flags+=("--selector=") + two_word_flags+=("--selector") + two_word_flags+=("-l") + local_nonpersistent_flags+=("--selector=") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_api-resources() +{ + last_command="kubectl_api-resources" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--api-group=") + two_word_flags+=("--api-group") + local_nonpersistent_flags+=("--api-group=") + flags+=("--cached") + local_nonpersistent_flags+=("--cached") + flags+=("--namespaced") + local_nonpersistent_flags+=("--namespaced") + flags+=("--no-headers") + local_nonpersistent_flags+=("--no-headers") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--sort-by=") + two_word_flags+=("--sort-by") + local_nonpersistent_flags+=("--sort-by=") + flags+=("--verbs=") + two_word_flags+=("--verbs") + local_nonpersistent_flags+=("--verbs=") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_api-versions() +{ + last_command="kubectl_api-versions" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_apply_edit-last-applied() +{ + last_command="kubectl_apply_edit-last-applied" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--filename=") + two_word_flags+=("--filename") + flags_with_completion+=("--filename") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + local_nonpersistent_flags+=("--filename=") + flags+=("--kustomize=") + two_word_flags+=("--kustomize") + two_word_flags+=("-k") + local_nonpersistent_flags+=("--kustomize=") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--record") + local_nonpersistent_flags+=("--record") + flags+=("--recursive") + flags+=("-R") + local_nonpersistent_flags+=("--recursive") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--windows-line-endings") + local_nonpersistent_flags+=("--windows-line-endings") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_apply_set-last-applied() +{ + last_command="kubectl_apply_set-last-applied" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--create-annotation") + local_nonpersistent_flags+=("--create-annotation") + flags+=("--dry-run") + local_nonpersistent_flags+=("--dry-run") + flags+=("--filename=") + two_word_flags+=("--filename") + flags_with_completion+=("--filename") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + local_nonpersistent_flags+=("--filename=") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_apply_view-last-applied() +{ + last_command="kubectl_apply_view-last-applied" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--all") + local_nonpersistent_flags+=("--all") + flags+=("--filename=") + two_word_flags+=("--filename") + flags_with_completion+=("--filename") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + local_nonpersistent_flags+=("--filename=") + flags+=("--kustomize=") + two_word_flags+=("--kustomize") + two_word_flags+=("-k") + local_nonpersistent_flags+=("--kustomize=") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--recursive") + flags+=("-R") + local_nonpersistent_flags+=("--recursive") + flags+=("--selector=") + two_word_flags+=("--selector") + two_word_flags+=("-l") + local_nonpersistent_flags+=("--selector=") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_apply() +{ + last_command="kubectl_apply" + + command_aliases=() + + commands=() + commands+=("edit-last-applied") + commands+=("set-last-applied") + commands+=("view-last-applied") + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--all") + local_nonpersistent_flags+=("--all") + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--cascade") + local_nonpersistent_flags+=("--cascade") + flags+=("--dry-run") + local_nonpersistent_flags+=("--dry-run") + flags+=("--field-manager=") + two_word_flags+=("--field-manager") + local_nonpersistent_flags+=("--field-manager=") + flags+=("--filename=") + two_word_flags+=("--filename") + flags_with_completion+=("--filename") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + local_nonpersistent_flags+=("--filename=") + flags+=("--force") + local_nonpersistent_flags+=("--force") + flags+=("--force-conflicts") + local_nonpersistent_flags+=("--force-conflicts") + flags+=("--grace-period=") + two_word_flags+=("--grace-period") + local_nonpersistent_flags+=("--grace-period=") + flags+=("--kustomize=") + two_word_flags+=("--kustomize") + two_word_flags+=("-k") + local_nonpersistent_flags+=("--kustomize=") + flags+=("--openapi-patch") + local_nonpersistent_flags+=("--openapi-patch") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--overwrite") + local_nonpersistent_flags+=("--overwrite") + flags+=("--prune") + local_nonpersistent_flags+=("--prune") + flags+=("--prune-whitelist=") + two_word_flags+=("--prune-whitelist") + local_nonpersistent_flags+=("--prune-whitelist=") + flags+=("--record") + local_nonpersistent_flags+=("--record") + flags+=("--recursive") + flags+=("-R") + local_nonpersistent_flags+=("--recursive") + flags+=("--selector=") + two_word_flags+=("--selector") + two_word_flags+=("-l") + local_nonpersistent_flags+=("--selector=") + flags+=("--server-side") + local_nonpersistent_flags+=("--server-side") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--timeout=") + two_word_flags+=("--timeout") + local_nonpersistent_flags+=("--timeout=") + flags+=("--validate") + local_nonpersistent_flags+=("--validate") + flags+=("--wait") + local_nonpersistent_flags+=("--wait") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_attach() +{ + last_command="kubectl_attach" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--container=") + two_word_flags+=("--container") + two_word_flags+=("-c") + local_nonpersistent_flags+=("--container=") + flags+=("--pod-running-timeout=") + two_word_flags+=("--pod-running-timeout") + local_nonpersistent_flags+=("--pod-running-timeout=") + flags+=("--stdin") + flags+=("-i") + local_nonpersistent_flags+=("--stdin") + flags+=("--tty") + flags+=("-t") + local_nonpersistent_flags+=("--tty") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_auth_can-i() +{ + last_command="kubectl_auth_can-i" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--all-namespaces") + flags+=("-A") + local_nonpersistent_flags+=("--all-namespaces") + flags+=("--list") + local_nonpersistent_flags+=("--list") + flags+=("--no-headers") + local_nonpersistent_flags+=("--no-headers") + flags+=("--quiet") + flags+=("-q") + local_nonpersistent_flags+=("--quiet") + flags+=("--subresource=") + two_word_flags+=("--subresource") + local_nonpersistent_flags+=("--subresource=") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_auth_reconcile() +{ + last_command="kubectl_auth_reconcile" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--dry-run") + local_nonpersistent_flags+=("--dry-run") + flags+=("--filename=") + two_word_flags+=("--filename") + flags_with_completion+=("--filename") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + local_nonpersistent_flags+=("--filename=") + flags+=("--kustomize=") + two_word_flags+=("--kustomize") + two_word_flags+=("-k") + local_nonpersistent_flags+=("--kustomize=") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--recursive") + flags+=("-R") + local_nonpersistent_flags+=("--recursive") + flags+=("--remove-extra-permissions") + local_nonpersistent_flags+=("--remove-extra-permissions") + flags+=("--remove-extra-subjects") + local_nonpersistent_flags+=("--remove-extra-subjects") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_auth() +{ + last_command="kubectl_auth" + + command_aliases=() + + commands=() + commands+=("can-i") + commands+=("reconcile") + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_autoscale() +{ + last_command="kubectl_autoscale" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--cpu-percent=") + two_word_flags+=("--cpu-percent") + local_nonpersistent_flags+=("--cpu-percent=") + flags+=("--dry-run") + local_nonpersistent_flags+=("--dry-run") + flags+=("--filename=") + two_word_flags+=("--filename") + flags_with_completion+=("--filename") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + local_nonpersistent_flags+=("--filename=") + flags+=("--generator=") + two_word_flags+=("--generator") + local_nonpersistent_flags+=("--generator=") + flags+=("--kustomize=") + two_word_flags+=("--kustomize") + two_word_flags+=("-k") + local_nonpersistent_flags+=("--kustomize=") + flags+=("--max=") + two_word_flags+=("--max") + local_nonpersistent_flags+=("--max=") + flags+=("--min=") + two_word_flags+=("--min") + local_nonpersistent_flags+=("--min=") + flags+=("--name=") + two_word_flags+=("--name") + local_nonpersistent_flags+=("--name=") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--record") + local_nonpersistent_flags+=("--record") + flags+=("--recursive") + flags+=("-R") + local_nonpersistent_flags+=("--recursive") + flags+=("--save-config") + local_nonpersistent_flags+=("--save-config") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_flag+=("--max=") + must_have_one_noun=() + must_have_one_noun+=("deployment") + must_have_one_noun+=("replicaset") + must_have_one_noun+=("replicationcontroller") + noun_aliases=() +} + +_kubectl_certificate_approve() +{ + last_command="kubectl_certificate_approve" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--filename=") + two_word_flags+=("--filename") + flags_with_completion+=("--filename") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + local_nonpersistent_flags+=("--filename=") + flags+=("--force") + local_nonpersistent_flags+=("--force") + flags+=("--kustomize=") + two_word_flags+=("--kustomize") + two_word_flags+=("-k") + local_nonpersistent_flags+=("--kustomize=") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--recursive") + flags+=("-R") + local_nonpersistent_flags+=("--recursive") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_certificate_deny() +{ + last_command="kubectl_certificate_deny" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--filename=") + two_word_flags+=("--filename") + flags_with_completion+=("--filename") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + local_nonpersistent_flags+=("--filename=") + flags+=("--force") + local_nonpersistent_flags+=("--force") + flags+=("--kustomize=") + two_word_flags+=("--kustomize") + two_word_flags+=("-k") + local_nonpersistent_flags+=("--kustomize=") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--recursive") + flags+=("-R") + local_nonpersistent_flags+=("--recursive") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_certificate() +{ + last_command="kubectl_certificate" + + command_aliases=() + + commands=() + commands+=("approve") + commands+=("deny") + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_cluster-info_dump() +{ + last_command="kubectl_cluster-info_dump" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--all-namespaces") + flags+=("-A") + local_nonpersistent_flags+=("--all-namespaces") + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--namespaces=") + two_word_flags+=("--namespaces") + local_nonpersistent_flags+=("--namespaces=") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--output-directory=") + two_word_flags+=("--output-directory") + local_nonpersistent_flags+=("--output-directory=") + flags+=("--pod-running-timeout=") + two_word_flags+=("--pod-running-timeout") + local_nonpersistent_flags+=("--pod-running-timeout=") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_cluster-info() +{ + last_command="kubectl_cluster-info" + + command_aliases=() + + commands=() + commands+=("dump") + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_completion() +{ + last_command="kubectl_completion" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--help") + flags+=("-h") + local_nonpersistent_flags+=("--help") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + must_have_one_noun+=("bash") + must_have_one_noun+=("zsh") + noun_aliases=() +} + +_kubectl_config_current-context() +{ + last_command="kubectl_config_current-context" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_config_delete-cluster() +{ + last_command="kubectl_config_delete-cluster" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_config_delete-context() +{ + last_command="kubectl_config_delete-context" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_config_get-clusters() +{ + last_command="kubectl_config_get-clusters" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_config_get-contexts() +{ + last_command="kubectl_config_get-contexts" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--no-headers") + local_nonpersistent_flags+=("--no-headers") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_config_rename-context() +{ + last_command="kubectl_config_rename-context" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_config_set() +{ + last_command="kubectl_config_set" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--set-raw-bytes") + local_nonpersistent_flags+=("--set-raw-bytes") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_config_set-cluster() +{ + last_command="kubectl_config_set-cluster" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--embed-certs") + local_nonpersistent_flags+=("--embed-certs") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_config_set-context() +{ + last_command="kubectl_config_set-context" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--current") + local_nonpersistent_flags+=("--current") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_config_set-credentials() +{ + last_command="kubectl_config_set-credentials" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--auth-provider=") + two_word_flags+=("--auth-provider") + local_nonpersistent_flags+=("--auth-provider=") + flags+=("--auth-provider-arg=") + two_word_flags+=("--auth-provider-arg") + local_nonpersistent_flags+=("--auth-provider-arg=") + flags+=("--embed-certs") + local_nonpersistent_flags+=("--embed-certs") + flags+=("--exec-api-version=") + two_word_flags+=("--exec-api-version") + local_nonpersistent_flags+=("--exec-api-version=") + flags+=("--exec-arg=") + two_word_flags+=("--exec-arg") + local_nonpersistent_flags+=("--exec-arg=") + flags+=("--exec-command=") + two_word_flags+=("--exec-command") + local_nonpersistent_flags+=("--exec-command=") + flags+=("--exec-env=") + two_word_flags+=("--exec-env") + local_nonpersistent_flags+=("--exec-env=") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_config_unset() +{ + last_command="kubectl_config_unset" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_config_use-context() +{ + last_command="kubectl_config_use-context" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_config_view() +{ + last_command="kubectl_config_view" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--flatten") + local_nonpersistent_flags+=("--flatten") + flags+=("--merge") + local_nonpersistent_flags+=("--merge") + flags+=("--minify") + local_nonpersistent_flags+=("--minify") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--raw") + local_nonpersistent_flags+=("--raw") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_config() +{ + last_command="kubectl_config" + + command_aliases=() + + commands=() + commands+=("current-context") + commands+=("delete-cluster") + commands+=("delete-context") + commands+=("get-clusters") + commands+=("get-contexts") + commands+=("rename-context") + commands+=("set") + commands+=("set-cluster") + commands+=("set-context") + commands+=("set-credentials") + commands+=("unset") + commands+=("use-context") + if [[ -z "${BASH_VERSION}" || "${BASH_VERSINFO[0]}" -gt 3 ]]; then + command_aliases+=("use") + aliashash["use"]="use-context" + fi + commands+=("view") + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_convert() +{ + last_command="kubectl_convert" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--filename=") + two_word_flags+=("--filename") + flags_with_completion+=("--filename") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + local_nonpersistent_flags+=("--filename=") + flags+=("--kustomize=") + two_word_flags+=("--kustomize") + two_word_flags+=("-k") + local_nonpersistent_flags+=("--kustomize=") + flags+=("--local") + local_nonpersistent_flags+=("--local") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--output-version=") + two_word_flags+=("--output-version") + local_nonpersistent_flags+=("--output-version=") + flags+=("--recursive") + flags+=("-R") + local_nonpersistent_flags+=("--recursive") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--validate") + local_nonpersistent_flags+=("--validate") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_cordon() +{ + last_command="kubectl_cordon" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--dry-run") + local_nonpersistent_flags+=("--dry-run") + flags+=("--selector=") + two_word_flags+=("--selector") + two_word_flags+=("-l") + local_nonpersistent_flags+=("--selector=") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_cp() +{ + last_command="kubectl_cp" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--container=") + two_word_flags+=("--container") + two_word_flags+=("-c") + local_nonpersistent_flags+=("--container=") + flags+=("--no-preserve") + local_nonpersistent_flags+=("--no-preserve") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_create_clusterrole() +{ + last_command="kubectl_create_clusterrole" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--aggregation-rule=") + two_word_flags+=("--aggregation-rule") + local_nonpersistent_flags+=("--aggregation-rule=") + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--dry-run") + local_nonpersistent_flags+=("--dry-run") + flags+=("--non-resource-url=") + two_word_flags+=("--non-resource-url") + local_nonpersistent_flags+=("--non-resource-url=") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--resource=") + two_word_flags+=("--resource") + local_nonpersistent_flags+=("--resource=") + flags+=("--resource-name=") + two_word_flags+=("--resource-name") + local_nonpersistent_flags+=("--resource-name=") + flags+=("--save-config") + local_nonpersistent_flags+=("--save-config") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--validate") + local_nonpersistent_flags+=("--validate") + flags+=("--verb=") + two_word_flags+=("--verb") + local_nonpersistent_flags+=("--verb=") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_create_clusterrolebinding() +{ + last_command="kubectl_create_clusterrolebinding" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--clusterrole=") + two_word_flags+=("--clusterrole") + flags_with_completion+=("--clusterrole") + flags_completion+=("__kubectl_get_resource_clusterrole") + local_nonpersistent_flags+=("--clusterrole=") + flags+=("--dry-run") + local_nonpersistent_flags+=("--dry-run") + flags+=("--group=") + two_word_flags+=("--group") + local_nonpersistent_flags+=("--group=") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--save-config") + local_nonpersistent_flags+=("--save-config") + flags+=("--serviceaccount=") + two_word_flags+=("--serviceaccount") + local_nonpersistent_flags+=("--serviceaccount=") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--validate") + local_nonpersistent_flags+=("--validate") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_create_configmap() +{ + last_command="kubectl_create_configmap" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--append-hash") + local_nonpersistent_flags+=("--append-hash") + flags+=("--dry-run") + local_nonpersistent_flags+=("--dry-run") + flags+=("--from-env-file=") + two_word_flags+=("--from-env-file") + local_nonpersistent_flags+=("--from-env-file=") + flags+=("--from-file=") + two_word_flags+=("--from-file") + local_nonpersistent_flags+=("--from-file=") + flags+=("--from-literal=") + two_word_flags+=("--from-literal") + local_nonpersistent_flags+=("--from-literal=") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--save-config") + local_nonpersistent_flags+=("--save-config") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--validate") + local_nonpersistent_flags+=("--validate") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_create_cronjob() +{ + last_command="kubectl_create_cronjob" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--dry-run") + local_nonpersistent_flags+=("--dry-run") + flags+=("--image=") + two_word_flags+=("--image") + local_nonpersistent_flags+=("--image=") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--restart=") + two_word_flags+=("--restart") + local_nonpersistent_flags+=("--restart=") + flags+=("--save-config") + local_nonpersistent_flags+=("--save-config") + flags+=("--schedule=") + two_word_flags+=("--schedule") + local_nonpersistent_flags+=("--schedule=") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--validate") + local_nonpersistent_flags+=("--validate") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_create_deployment() +{ + last_command="kubectl_create_deployment" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--dry-run") + local_nonpersistent_flags+=("--dry-run") + flags+=("--image=") + two_word_flags+=("--image") + local_nonpersistent_flags+=("--image=") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--save-config") + local_nonpersistent_flags+=("--save-config") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--validate") + local_nonpersistent_flags+=("--validate") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_flag+=("--image=") + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_create_job() +{ + last_command="kubectl_create_job" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--dry-run") + local_nonpersistent_flags+=("--dry-run") + flags+=("--from=") + two_word_flags+=("--from") + local_nonpersistent_flags+=("--from=") + flags+=("--image=") + two_word_flags+=("--image") + local_nonpersistent_flags+=("--image=") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--save-config") + local_nonpersistent_flags+=("--save-config") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--validate") + local_nonpersistent_flags+=("--validate") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_create_namespace() +{ + last_command="kubectl_create_namespace" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--dry-run") + local_nonpersistent_flags+=("--dry-run") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--save-config") + local_nonpersistent_flags+=("--save-config") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--validate") + local_nonpersistent_flags+=("--validate") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_create_poddisruptionbudget() +{ + last_command="kubectl_create_poddisruptionbudget" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--dry-run") + local_nonpersistent_flags+=("--dry-run") + flags+=("--max-unavailable=") + two_word_flags+=("--max-unavailable") + local_nonpersistent_flags+=("--max-unavailable=") + flags+=("--min-available=") + two_word_flags+=("--min-available") + local_nonpersistent_flags+=("--min-available=") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--save-config") + local_nonpersistent_flags+=("--save-config") + flags+=("--selector=") + two_word_flags+=("--selector") + local_nonpersistent_flags+=("--selector=") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--validate") + local_nonpersistent_flags+=("--validate") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_create_priorityclass() +{ + last_command="kubectl_create_priorityclass" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--description=") + two_word_flags+=("--description") + local_nonpersistent_flags+=("--description=") + flags+=("--dry-run") + local_nonpersistent_flags+=("--dry-run") + flags+=("--global-default") + local_nonpersistent_flags+=("--global-default") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--preemption-policy=") + two_word_flags+=("--preemption-policy") + local_nonpersistent_flags+=("--preemption-policy=") + flags+=("--save-config") + local_nonpersistent_flags+=("--save-config") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--validate") + local_nonpersistent_flags+=("--validate") + flags+=("--value=") + two_word_flags+=("--value") + local_nonpersistent_flags+=("--value=") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_create_quota() +{ + last_command="kubectl_create_quota" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--dry-run") + local_nonpersistent_flags+=("--dry-run") + flags+=("--hard=") + two_word_flags+=("--hard") + local_nonpersistent_flags+=("--hard=") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--save-config") + local_nonpersistent_flags+=("--save-config") + flags+=("--scopes=") + two_word_flags+=("--scopes") + local_nonpersistent_flags+=("--scopes=") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--validate") + local_nonpersistent_flags+=("--validate") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_create_role() +{ + last_command="kubectl_create_role" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--dry-run") + local_nonpersistent_flags+=("--dry-run") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--resource=") + two_word_flags+=("--resource") + local_nonpersistent_flags+=("--resource=") + flags+=("--resource-name=") + two_word_flags+=("--resource-name") + local_nonpersistent_flags+=("--resource-name=") + flags+=("--save-config") + local_nonpersistent_flags+=("--save-config") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--validate") + local_nonpersistent_flags+=("--validate") + flags+=("--verb=") + two_word_flags+=("--verb") + local_nonpersistent_flags+=("--verb=") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_create_rolebinding() +{ + last_command="kubectl_create_rolebinding" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--clusterrole=") + two_word_flags+=("--clusterrole") + local_nonpersistent_flags+=("--clusterrole=") + flags+=("--dry-run") + local_nonpersistent_flags+=("--dry-run") + flags+=("--group=") + two_word_flags+=("--group") + local_nonpersistent_flags+=("--group=") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--role=") + two_word_flags+=("--role") + local_nonpersistent_flags+=("--role=") + flags+=("--save-config") + local_nonpersistent_flags+=("--save-config") + flags+=("--serviceaccount=") + two_word_flags+=("--serviceaccount") + local_nonpersistent_flags+=("--serviceaccount=") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--validate") + local_nonpersistent_flags+=("--validate") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_create_secret_docker-registry() +{ + last_command="kubectl_create_secret_docker-registry" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--append-hash") + local_nonpersistent_flags+=("--append-hash") + flags+=("--docker-email=") + two_word_flags+=("--docker-email") + local_nonpersistent_flags+=("--docker-email=") + flags+=("--docker-password=") + two_word_flags+=("--docker-password") + local_nonpersistent_flags+=("--docker-password=") + flags+=("--docker-server=") + two_word_flags+=("--docker-server") + local_nonpersistent_flags+=("--docker-server=") + flags+=("--docker-username=") + two_word_flags+=("--docker-username") + local_nonpersistent_flags+=("--docker-username=") + flags+=("--dry-run") + local_nonpersistent_flags+=("--dry-run") + flags+=("--from-file=") + two_word_flags+=("--from-file") + local_nonpersistent_flags+=("--from-file=") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--save-config") + local_nonpersistent_flags+=("--save-config") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--validate") + local_nonpersistent_flags+=("--validate") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_flag+=("--docker-password=") + must_have_one_flag+=("--docker-username=") + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_create_secret_generic() +{ + last_command="kubectl_create_secret_generic" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--append-hash") + local_nonpersistent_flags+=("--append-hash") + flags+=("--dry-run") + local_nonpersistent_flags+=("--dry-run") + flags+=("--from-env-file=") + two_word_flags+=("--from-env-file") + local_nonpersistent_flags+=("--from-env-file=") + flags+=("--from-file=") + two_word_flags+=("--from-file") + local_nonpersistent_flags+=("--from-file=") + flags+=("--from-literal=") + two_word_flags+=("--from-literal") + local_nonpersistent_flags+=("--from-literal=") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--save-config") + local_nonpersistent_flags+=("--save-config") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--type=") + two_word_flags+=("--type") + local_nonpersistent_flags+=("--type=") + flags+=("--validate") + local_nonpersistent_flags+=("--validate") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_create_secret_tls() +{ + last_command="kubectl_create_secret_tls" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--append-hash") + local_nonpersistent_flags+=("--append-hash") + flags+=("--cert=") + two_word_flags+=("--cert") + local_nonpersistent_flags+=("--cert=") + flags+=("--dry-run") + local_nonpersistent_flags+=("--dry-run") + flags+=("--key=") + two_word_flags+=("--key") + local_nonpersistent_flags+=("--key=") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--save-config") + local_nonpersistent_flags+=("--save-config") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--validate") + local_nonpersistent_flags+=("--validate") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_create_secret() +{ + last_command="kubectl_create_secret" + + command_aliases=() + + commands=() + commands+=("docker-registry") + commands+=("generic") + commands+=("tls") + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_create_service_clusterip() +{ + last_command="kubectl_create_service_clusterip" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--clusterip=") + two_word_flags+=("--clusterip") + local_nonpersistent_flags+=("--clusterip=") + flags+=("--dry-run") + local_nonpersistent_flags+=("--dry-run") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--save-config") + local_nonpersistent_flags+=("--save-config") + flags+=("--tcp=") + two_word_flags+=("--tcp") + local_nonpersistent_flags+=("--tcp=") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--validate") + local_nonpersistent_flags+=("--validate") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_create_service_externalname() +{ + last_command="kubectl_create_service_externalname" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--dry-run") + local_nonpersistent_flags+=("--dry-run") + flags+=("--external-name=") + two_word_flags+=("--external-name") + local_nonpersistent_flags+=("--external-name=") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--save-config") + local_nonpersistent_flags+=("--save-config") + flags+=("--tcp=") + two_word_flags+=("--tcp") + local_nonpersistent_flags+=("--tcp=") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--validate") + local_nonpersistent_flags+=("--validate") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_flag+=("--external-name=") + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_create_service_loadbalancer() +{ + last_command="kubectl_create_service_loadbalancer" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--dry-run") + local_nonpersistent_flags+=("--dry-run") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--save-config") + local_nonpersistent_flags+=("--save-config") + flags+=("--tcp=") + two_word_flags+=("--tcp") + local_nonpersistent_flags+=("--tcp=") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--validate") + local_nonpersistent_flags+=("--validate") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_create_service_nodeport() +{ + last_command="kubectl_create_service_nodeport" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--dry-run") + local_nonpersistent_flags+=("--dry-run") + flags+=("--node-port=") + two_word_flags+=("--node-port") + local_nonpersistent_flags+=("--node-port=") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--save-config") + local_nonpersistent_flags+=("--save-config") + flags+=("--tcp=") + two_word_flags+=("--tcp") + local_nonpersistent_flags+=("--tcp=") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--validate") + local_nonpersistent_flags+=("--validate") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_create_service() +{ + last_command="kubectl_create_service" + + command_aliases=() + + commands=() + commands+=("clusterip") + commands+=("externalname") + commands+=("loadbalancer") + commands+=("nodeport") + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_create_serviceaccount() +{ + last_command="kubectl_create_serviceaccount" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--dry-run") + local_nonpersistent_flags+=("--dry-run") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--save-config") + local_nonpersistent_flags+=("--save-config") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--validate") + local_nonpersistent_flags+=("--validate") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_create() +{ + last_command="kubectl_create" + + command_aliases=() + + commands=() + commands+=("clusterrole") + commands+=("clusterrolebinding") + commands+=("configmap") + if [[ -z "${BASH_VERSION}" || "${BASH_VERSINFO[0]}" -gt 3 ]]; then + command_aliases+=("cm") + aliashash["cm"]="configmap" + fi + commands+=("cronjob") + if [[ -z "${BASH_VERSION}" || "${BASH_VERSINFO[0]}" -gt 3 ]]; then + command_aliases+=("cj") + aliashash["cj"]="cronjob" + fi + commands+=("deployment") + if [[ -z "${BASH_VERSION}" || "${BASH_VERSINFO[0]}" -gt 3 ]]; then + command_aliases+=("deploy") + aliashash["deploy"]="deployment" + fi + commands+=("job") + commands+=("namespace") + if [[ -z "${BASH_VERSION}" || "${BASH_VERSINFO[0]}" -gt 3 ]]; then + command_aliases+=("ns") + aliashash["ns"]="namespace" + fi + commands+=("poddisruptionbudget") + if [[ -z "${BASH_VERSION}" || "${BASH_VERSINFO[0]}" -gt 3 ]]; then + command_aliases+=("pdb") + aliashash["pdb"]="poddisruptionbudget" + fi + commands+=("priorityclass") + if [[ -z "${BASH_VERSION}" || "${BASH_VERSINFO[0]}" -gt 3 ]]; then + command_aliases+=("pc") + aliashash["pc"]="priorityclass" + fi + commands+=("quota") + if [[ -z "${BASH_VERSION}" || "${BASH_VERSINFO[0]}" -gt 3 ]]; then + command_aliases+=("resourcequota") + aliashash["resourcequota"]="quota" + fi + commands+=("role") + commands+=("rolebinding") + commands+=("secret") + commands+=("service") + if [[ -z "${BASH_VERSION}" || "${BASH_VERSINFO[0]}" -gt 3 ]]; then + command_aliases+=("svc") + aliashash["svc"]="service" + fi + commands+=("serviceaccount") + if [[ -z "${BASH_VERSION}" || "${BASH_VERSINFO[0]}" -gt 3 ]]; then + command_aliases+=("sa") + aliashash["sa"]="serviceaccount" + fi + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--dry-run") + local_nonpersistent_flags+=("--dry-run") + flags+=("--edit") + local_nonpersistent_flags+=("--edit") + flags+=("--filename=") + two_word_flags+=("--filename") + flags_with_completion+=("--filename") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + local_nonpersistent_flags+=("--filename=") + flags+=("--kustomize=") + two_word_flags+=("--kustomize") + two_word_flags+=("-k") + local_nonpersistent_flags+=("--kustomize=") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--raw=") + two_word_flags+=("--raw") + local_nonpersistent_flags+=("--raw=") + flags+=("--record") + local_nonpersistent_flags+=("--record") + flags+=("--recursive") + flags+=("-R") + local_nonpersistent_flags+=("--recursive") + flags+=("--save-config") + local_nonpersistent_flags+=("--save-config") + flags+=("--selector=") + two_word_flags+=("--selector") + two_word_flags+=("-l") + local_nonpersistent_flags+=("--selector=") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--validate") + local_nonpersistent_flags+=("--validate") + flags+=("--windows-line-endings") + local_nonpersistent_flags+=("--windows-line-endings") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_delete() +{ + last_command="kubectl_delete" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--all") + local_nonpersistent_flags+=("--all") + flags+=("--all-namespaces") + flags+=("-A") + local_nonpersistent_flags+=("--all-namespaces") + flags+=("--cascade") + local_nonpersistent_flags+=("--cascade") + flags+=("--dry-run") + local_nonpersistent_flags+=("--dry-run") + flags+=("--field-selector=") + two_word_flags+=("--field-selector") + local_nonpersistent_flags+=("--field-selector=") + flags+=("--filename=") + two_word_flags+=("--filename") + flags_with_completion+=("--filename") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + local_nonpersistent_flags+=("--filename=") + flags+=("--force") + local_nonpersistent_flags+=("--force") + flags+=("--grace-period=") + two_word_flags+=("--grace-period") + local_nonpersistent_flags+=("--grace-period=") + flags+=("--ignore-not-found") + local_nonpersistent_flags+=("--ignore-not-found") + flags+=("--kustomize=") + two_word_flags+=("--kustomize") + two_word_flags+=("-k") + local_nonpersistent_flags+=("--kustomize=") + flags+=("--now") + local_nonpersistent_flags+=("--now") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--raw=") + two_word_flags+=("--raw") + local_nonpersistent_flags+=("--raw=") + flags+=("--recursive") + flags+=("-R") + local_nonpersistent_flags+=("--recursive") + flags+=("--selector=") + two_word_flags+=("--selector") + two_word_flags+=("-l") + local_nonpersistent_flags+=("--selector=") + flags+=("--timeout=") + two_word_flags+=("--timeout") + local_nonpersistent_flags+=("--timeout=") + flags+=("--wait") + local_nonpersistent_flags+=("--wait") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_describe() +{ + last_command="kubectl_describe" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--all-namespaces") + flags+=("-A") + local_nonpersistent_flags+=("--all-namespaces") + flags+=("--filename=") + two_word_flags+=("--filename") + flags_with_completion+=("--filename") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + local_nonpersistent_flags+=("--filename=") + flags+=("--kustomize=") + two_word_flags+=("--kustomize") + two_word_flags+=("-k") + local_nonpersistent_flags+=("--kustomize=") + flags+=("--recursive") + flags+=("-R") + local_nonpersistent_flags+=("--recursive") + flags+=("--selector=") + two_word_flags+=("--selector") + two_word_flags+=("-l") + local_nonpersistent_flags+=("--selector=") + flags+=("--show-events") + local_nonpersistent_flags+=("--show-events") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_diff() +{ + last_command="kubectl_diff" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--field-manager=") + two_word_flags+=("--field-manager") + local_nonpersistent_flags+=("--field-manager=") + flags+=("--filename=") + two_word_flags+=("--filename") + flags_with_completion+=("--filename") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + local_nonpersistent_flags+=("--filename=") + flags+=("--force-conflicts") + local_nonpersistent_flags+=("--force-conflicts") + flags+=("--kustomize=") + two_word_flags+=("--kustomize") + two_word_flags+=("-k") + local_nonpersistent_flags+=("--kustomize=") + flags+=("--recursive") + flags+=("-R") + local_nonpersistent_flags+=("--recursive") + flags+=("--server-side") + local_nonpersistent_flags+=("--server-side") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_drain() +{ + last_command="kubectl_drain" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--delete-local-data") + local_nonpersistent_flags+=("--delete-local-data") + flags+=("--disable-eviction") + local_nonpersistent_flags+=("--disable-eviction") + flags+=("--dry-run") + local_nonpersistent_flags+=("--dry-run") + flags+=("--force") + local_nonpersistent_flags+=("--force") + flags+=("--grace-period=") + two_word_flags+=("--grace-period") + local_nonpersistent_flags+=("--grace-period=") + flags+=("--ignore-daemonsets") + local_nonpersistent_flags+=("--ignore-daemonsets") + flags+=("--pod-selector=") + two_word_flags+=("--pod-selector") + local_nonpersistent_flags+=("--pod-selector=") + flags+=("--selector=") + two_word_flags+=("--selector") + two_word_flags+=("-l") + local_nonpersistent_flags+=("--selector=") + flags+=("--skip-wait-for-delete-timeout=") + two_word_flags+=("--skip-wait-for-delete-timeout") + local_nonpersistent_flags+=("--skip-wait-for-delete-timeout=") + flags+=("--timeout=") + two_word_flags+=("--timeout") + local_nonpersistent_flags+=("--timeout=") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_edit() +{ + last_command="kubectl_edit" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--filename=") + two_word_flags+=("--filename") + flags_with_completion+=("--filename") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + local_nonpersistent_flags+=("--filename=") + flags+=("--kustomize=") + two_word_flags+=("--kustomize") + two_word_flags+=("-k") + local_nonpersistent_flags+=("--kustomize=") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--output-patch") + local_nonpersistent_flags+=("--output-patch") + flags+=("--record") + local_nonpersistent_flags+=("--record") + flags+=("--recursive") + flags+=("-R") + local_nonpersistent_flags+=("--recursive") + flags+=("--save-config") + local_nonpersistent_flags+=("--save-config") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--validate") + local_nonpersistent_flags+=("--validate") + flags+=("--windows-line-endings") + local_nonpersistent_flags+=("--windows-line-endings") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_exec() +{ + last_command="kubectl_exec" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--container=") + two_word_flags+=("--container") + two_word_flags+=("-c") + local_nonpersistent_flags+=("--container=") + flags+=("--filename=") + two_word_flags+=("--filename") + flags_with_completion+=("--filename") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + local_nonpersistent_flags+=("--filename=") + flags+=("--pod-running-timeout=") + two_word_flags+=("--pod-running-timeout") + local_nonpersistent_flags+=("--pod-running-timeout=") + flags+=("--stdin") + flags+=("-i") + local_nonpersistent_flags+=("--stdin") + flags+=("--tty") + flags+=("-t") + local_nonpersistent_flags+=("--tty") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_explain() +{ + last_command="kubectl_explain" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--api-version=") + two_word_flags+=("--api-version") + local_nonpersistent_flags+=("--api-version=") + flags+=("--recursive") + local_nonpersistent_flags+=("--recursive") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_expose() +{ + last_command="kubectl_expose" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--cluster-ip=") + two_word_flags+=("--cluster-ip") + local_nonpersistent_flags+=("--cluster-ip=") + flags+=("--dry-run") + local_nonpersistent_flags+=("--dry-run") + flags+=("--external-ip=") + two_word_flags+=("--external-ip") + local_nonpersistent_flags+=("--external-ip=") + flags+=("--filename=") + two_word_flags+=("--filename") + flags_with_completion+=("--filename") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + local_nonpersistent_flags+=("--filename=") + flags+=("--generator=") + two_word_flags+=("--generator") + local_nonpersistent_flags+=("--generator=") + flags+=("--kustomize=") + two_word_flags+=("--kustomize") + two_word_flags+=("-k") + local_nonpersistent_flags+=("--kustomize=") + flags+=("--labels=") + two_word_flags+=("--labels") + two_word_flags+=("-l") + local_nonpersistent_flags+=("--labels=") + flags+=("--load-balancer-ip=") + two_word_flags+=("--load-balancer-ip") + local_nonpersistent_flags+=("--load-balancer-ip=") + flags+=("--name=") + two_word_flags+=("--name") + local_nonpersistent_flags+=("--name=") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--overrides=") + two_word_flags+=("--overrides") + local_nonpersistent_flags+=("--overrides=") + flags+=("--port=") + two_word_flags+=("--port") + local_nonpersistent_flags+=("--port=") + flags+=("--protocol=") + two_word_flags+=("--protocol") + local_nonpersistent_flags+=("--protocol=") + flags+=("--record") + local_nonpersistent_flags+=("--record") + flags+=("--recursive") + flags+=("-R") + local_nonpersistent_flags+=("--recursive") + flags+=("--save-config") + local_nonpersistent_flags+=("--save-config") + flags+=("--selector=") + two_word_flags+=("--selector") + local_nonpersistent_flags+=("--selector=") + flags+=("--session-affinity=") + two_word_flags+=("--session-affinity") + local_nonpersistent_flags+=("--session-affinity=") + flags+=("--target-port=") + two_word_flags+=("--target-port") + local_nonpersistent_flags+=("--target-port=") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--type=") + two_word_flags+=("--type") + local_nonpersistent_flags+=("--type=") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + must_have_one_noun+=("deployment") + must_have_one_noun+=("pod") + must_have_one_noun+=("replicaset") + must_have_one_noun+=("replicationcontroller") + must_have_one_noun+=("service") + noun_aliases=() +} + +_kubectl_get() +{ + last_command="kubectl_get" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--all-namespaces") + flags+=("-A") + local_nonpersistent_flags+=("--all-namespaces") + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--chunk-size=") + two_word_flags+=("--chunk-size") + local_nonpersistent_flags+=("--chunk-size=") + flags+=("--field-selector=") + two_word_flags+=("--field-selector") + local_nonpersistent_flags+=("--field-selector=") + flags+=("--filename=") + two_word_flags+=("--filename") + flags_with_completion+=("--filename") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + local_nonpersistent_flags+=("--filename=") + flags+=("--ignore-not-found") + local_nonpersistent_flags+=("--ignore-not-found") + flags+=("--kustomize=") + two_word_flags+=("--kustomize") + two_word_flags+=("-k") + local_nonpersistent_flags+=("--kustomize=") + flags+=("--label-columns=") + two_word_flags+=("--label-columns") + two_word_flags+=("-L") + local_nonpersistent_flags+=("--label-columns=") + flags+=("--no-headers") + local_nonpersistent_flags+=("--no-headers") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--output-watch-events") + local_nonpersistent_flags+=("--output-watch-events") + flags+=("--raw=") + two_word_flags+=("--raw") + local_nonpersistent_flags+=("--raw=") + flags+=("--recursive") + flags+=("-R") + local_nonpersistent_flags+=("--recursive") + flags+=("--selector=") + two_word_flags+=("--selector") + two_word_flags+=("-l") + local_nonpersistent_flags+=("--selector=") + flags+=("--server-print") + local_nonpersistent_flags+=("--server-print") + flags+=("--show-kind") + local_nonpersistent_flags+=("--show-kind") + flags+=("--show-labels") + local_nonpersistent_flags+=("--show-labels") + flags+=("--sort-by=") + two_word_flags+=("--sort-by") + local_nonpersistent_flags+=("--sort-by=") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--watch") + flags+=("-w") + local_nonpersistent_flags+=("--watch") + flags+=("--watch-only") + local_nonpersistent_flags+=("--watch-only") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_kustomize() +{ + last_command="kubectl_kustomize" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_label() +{ + last_command="kubectl_label" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--all") + local_nonpersistent_flags+=("--all") + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--dry-run") + local_nonpersistent_flags+=("--dry-run") + flags+=("--field-selector=") + two_word_flags+=("--field-selector") + local_nonpersistent_flags+=("--field-selector=") + flags+=("--filename=") + two_word_flags+=("--filename") + flags_with_completion+=("--filename") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + local_nonpersistent_flags+=("--filename=") + flags+=("--kustomize=") + two_word_flags+=("--kustomize") + two_word_flags+=("-k") + local_nonpersistent_flags+=("--kustomize=") + flags+=("--list") + local_nonpersistent_flags+=("--list") + flags+=("--local") + local_nonpersistent_flags+=("--local") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--overwrite") + local_nonpersistent_flags+=("--overwrite") + flags+=("--record") + local_nonpersistent_flags+=("--record") + flags+=("--recursive") + flags+=("-R") + local_nonpersistent_flags+=("--recursive") + flags+=("--resource-version=") + two_word_flags+=("--resource-version") + local_nonpersistent_flags+=("--resource-version=") + flags+=("--selector=") + two_word_flags+=("--selector") + two_word_flags+=("-l") + local_nonpersistent_flags+=("--selector=") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_logs() +{ + last_command="kubectl_logs" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--all-containers") + local_nonpersistent_flags+=("--all-containers") + flags+=("--container=") + two_word_flags+=("--container") + two_word_flags+=("-c") + local_nonpersistent_flags+=("--container=") + flags+=("--follow") + flags+=("-f") + local_nonpersistent_flags+=("--follow") + flags+=("--ignore-errors") + local_nonpersistent_flags+=("--ignore-errors") + flags+=("--insecure-skip-tls-verify-backend") + local_nonpersistent_flags+=("--insecure-skip-tls-verify-backend") + flags+=("--limit-bytes=") + two_word_flags+=("--limit-bytes") + local_nonpersistent_flags+=("--limit-bytes=") + flags+=("--max-log-requests=") + two_word_flags+=("--max-log-requests") + local_nonpersistent_flags+=("--max-log-requests=") + flags+=("--pod-running-timeout=") + two_word_flags+=("--pod-running-timeout") + local_nonpersistent_flags+=("--pod-running-timeout=") + flags+=("--prefix") + local_nonpersistent_flags+=("--prefix") + flags+=("--previous") + flags+=("-p") + local_nonpersistent_flags+=("--previous") + flags+=("--selector=") + two_word_flags+=("--selector") + two_word_flags+=("-l") + local_nonpersistent_flags+=("--selector=") + flags+=("--since=") + two_word_flags+=("--since") + local_nonpersistent_flags+=("--since=") + flags+=("--since-time=") + two_word_flags+=("--since-time") + local_nonpersistent_flags+=("--since-time=") + flags+=("--tail=") + two_word_flags+=("--tail") + local_nonpersistent_flags+=("--tail=") + flags+=("--timestamps") + local_nonpersistent_flags+=("--timestamps") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_options() +{ + last_command="kubectl_options" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_patch() +{ + last_command="kubectl_patch" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--dry-run") + local_nonpersistent_flags+=("--dry-run") + flags+=("--filename=") + two_word_flags+=("--filename") + flags_with_completion+=("--filename") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + local_nonpersistent_flags+=("--filename=") + flags+=("--kustomize=") + two_word_flags+=("--kustomize") + two_word_flags+=("-k") + local_nonpersistent_flags+=("--kustomize=") + flags+=("--local") + local_nonpersistent_flags+=("--local") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--patch=") + two_word_flags+=("--patch") + two_word_flags+=("-p") + local_nonpersistent_flags+=("--patch=") + flags+=("--record") + local_nonpersistent_flags+=("--record") + flags+=("--recursive") + flags+=("-R") + local_nonpersistent_flags+=("--recursive") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--type=") + two_word_flags+=("--type") + local_nonpersistent_flags+=("--type=") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_flag+=("--patch=") + must_have_one_flag+=("-p") + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_plugin_list() +{ + last_command="kubectl_plugin_list" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--name-only") + local_nonpersistent_flags+=("--name-only") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_plugin() +{ + last_command="kubectl_plugin" + + command_aliases=() + + commands=() + commands+=("list") + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_port-forward() +{ + last_command="kubectl_port-forward" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--address=") + two_word_flags+=("--address") + local_nonpersistent_flags+=("--address=") + flags+=("--pod-running-timeout=") + two_word_flags+=("--pod-running-timeout") + local_nonpersistent_flags+=("--pod-running-timeout=") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_proxy() +{ + last_command="kubectl_proxy" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--accept-hosts=") + two_word_flags+=("--accept-hosts") + local_nonpersistent_flags+=("--accept-hosts=") + flags+=("--accept-paths=") + two_word_flags+=("--accept-paths") + local_nonpersistent_flags+=("--accept-paths=") + flags+=("--address=") + two_word_flags+=("--address") + local_nonpersistent_flags+=("--address=") + flags+=("--api-prefix=") + two_word_flags+=("--api-prefix") + local_nonpersistent_flags+=("--api-prefix=") + flags+=("--disable-filter") + local_nonpersistent_flags+=("--disable-filter") + flags+=("--keepalive=") + two_word_flags+=("--keepalive") + local_nonpersistent_flags+=("--keepalive=") + flags+=("--port=") + two_word_flags+=("--port") + two_word_flags+=("-p") + local_nonpersistent_flags+=("--port=") + flags+=("--reject-methods=") + two_word_flags+=("--reject-methods") + local_nonpersistent_flags+=("--reject-methods=") + flags+=("--reject-paths=") + two_word_flags+=("--reject-paths") + local_nonpersistent_flags+=("--reject-paths=") + flags+=("--unix-socket=") + two_word_flags+=("--unix-socket") + two_word_flags+=("-u") + local_nonpersistent_flags+=("--unix-socket=") + flags+=("--www=") + two_word_flags+=("--www") + two_word_flags+=("-w") + local_nonpersistent_flags+=("--www=") + flags+=("--www-prefix=") + two_word_flags+=("--www-prefix") + two_word_flags+=("-P") + local_nonpersistent_flags+=("--www-prefix=") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_replace() +{ + last_command="kubectl_replace" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--cascade") + local_nonpersistent_flags+=("--cascade") + flags+=("--dry-run") + local_nonpersistent_flags+=("--dry-run") + flags+=("--filename=") + two_word_flags+=("--filename") + flags_with_completion+=("--filename") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + local_nonpersistent_flags+=("--filename=") + flags+=("--force") + local_nonpersistent_flags+=("--force") + flags+=("--grace-period=") + two_word_flags+=("--grace-period") + local_nonpersistent_flags+=("--grace-period=") + flags+=("--kustomize=") + two_word_flags+=("--kustomize") + two_word_flags+=("-k") + local_nonpersistent_flags+=("--kustomize=") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--raw=") + two_word_flags+=("--raw") + local_nonpersistent_flags+=("--raw=") + flags+=("--recursive") + flags+=("-R") + local_nonpersistent_flags+=("--recursive") + flags+=("--save-config") + local_nonpersistent_flags+=("--save-config") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--timeout=") + two_word_flags+=("--timeout") + local_nonpersistent_flags+=("--timeout=") + flags+=("--validate") + local_nonpersistent_flags+=("--validate") + flags+=("--wait") + local_nonpersistent_flags+=("--wait") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_rollout_history() +{ + last_command="kubectl_rollout_history" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--filename=") + two_word_flags+=("--filename") + flags_with_completion+=("--filename") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + local_nonpersistent_flags+=("--filename=") + flags+=("--kustomize=") + two_word_flags+=("--kustomize") + two_word_flags+=("-k") + local_nonpersistent_flags+=("--kustomize=") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--recursive") + flags+=("-R") + local_nonpersistent_flags+=("--recursive") + flags+=("--revision=") + two_word_flags+=("--revision") + local_nonpersistent_flags+=("--revision=") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + must_have_one_noun+=("daemonset") + must_have_one_noun+=("deployment") + must_have_one_noun+=("statefulset") + noun_aliases=() +} + +_kubectl_rollout_pause() +{ + last_command="kubectl_rollout_pause" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--filename=") + two_word_flags+=("--filename") + flags_with_completion+=("--filename") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + local_nonpersistent_flags+=("--filename=") + flags+=("--kustomize=") + two_word_flags+=("--kustomize") + two_word_flags+=("-k") + local_nonpersistent_flags+=("--kustomize=") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--recursive") + flags+=("-R") + local_nonpersistent_flags+=("--recursive") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + must_have_one_noun+=("deployment") + noun_aliases=() +} + +_kubectl_rollout_restart() +{ + last_command="kubectl_rollout_restart" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--filename=") + two_word_flags+=("--filename") + flags_with_completion+=("--filename") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + local_nonpersistent_flags+=("--filename=") + flags+=("--kustomize=") + two_word_flags+=("--kustomize") + two_word_flags+=("-k") + local_nonpersistent_flags+=("--kustomize=") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--recursive") + flags+=("-R") + local_nonpersistent_flags+=("--recursive") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + must_have_one_noun+=("daemonset") + must_have_one_noun+=("deployment") + must_have_one_noun+=("statefulset") + noun_aliases=() +} + +_kubectl_rollout_resume() +{ + last_command="kubectl_rollout_resume" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--filename=") + two_word_flags+=("--filename") + flags_with_completion+=("--filename") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + local_nonpersistent_flags+=("--filename=") + flags+=("--kustomize=") + two_word_flags+=("--kustomize") + two_word_flags+=("-k") + local_nonpersistent_flags+=("--kustomize=") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--recursive") + flags+=("-R") + local_nonpersistent_flags+=("--recursive") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + must_have_one_noun+=("deployment") + noun_aliases=() +} + +_kubectl_rollout_status() +{ + last_command="kubectl_rollout_status" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--filename=") + two_word_flags+=("--filename") + flags_with_completion+=("--filename") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + local_nonpersistent_flags+=("--filename=") + flags+=("--kustomize=") + two_word_flags+=("--kustomize") + two_word_flags+=("-k") + local_nonpersistent_flags+=("--kustomize=") + flags+=("--recursive") + flags+=("-R") + local_nonpersistent_flags+=("--recursive") + flags+=("--revision=") + two_word_flags+=("--revision") + local_nonpersistent_flags+=("--revision=") + flags+=("--timeout=") + two_word_flags+=("--timeout") + local_nonpersistent_flags+=("--timeout=") + flags+=("--watch") + flags+=("-w") + local_nonpersistent_flags+=("--watch") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + must_have_one_noun+=("daemonset") + must_have_one_noun+=("deployment") + must_have_one_noun+=("statefulset") + noun_aliases=() +} + +_kubectl_rollout_undo() +{ + last_command="kubectl_rollout_undo" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--dry-run") + local_nonpersistent_flags+=("--dry-run") + flags+=("--filename=") + two_word_flags+=("--filename") + flags_with_completion+=("--filename") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + local_nonpersistent_flags+=("--filename=") + flags+=("--kustomize=") + two_word_flags+=("--kustomize") + two_word_flags+=("-k") + local_nonpersistent_flags+=("--kustomize=") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--recursive") + flags+=("-R") + local_nonpersistent_flags+=("--recursive") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--to-revision=") + two_word_flags+=("--to-revision") + local_nonpersistent_flags+=("--to-revision=") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + must_have_one_noun+=("daemonset") + must_have_one_noun+=("deployment") + must_have_one_noun+=("statefulset") + noun_aliases=() +} + +_kubectl_rollout() +{ + last_command="kubectl_rollout" + + command_aliases=() + + commands=() + commands+=("history") + commands+=("pause") + commands+=("restart") + commands+=("resume") + commands+=("status") + commands+=("undo") + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_run() +{ + last_command="kubectl_run" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--attach") + local_nonpersistent_flags+=("--attach") + flags+=("--cascade") + local_nonpersistent_flags+=("--cascade") + flags+=("--command") + local_nonpersistent_flags+=("--command") + flags+=("--dry-run") + local_nonpersistent_flags+=("--dry-run") + flags+=("--env=") + two_word_flags+=("--env") + local_nonpersistent_flags+=("--env=") + flags+=("--expose") + local_nonpersistent_flags+=("--expose") + flags+=("--filename=") + two_word_flags+=("--filename") + flags_with_completion+=("--filename") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + local_nonpersistent_flags+=("--filename=") + flags+=("--force") + local_nonpersistent_flags+=("--force") + flags+=("--grace-period=") + two_word_flags+=("--grace-period") + local_nonpersistent_flags+=("--grace-period=") + flags+=("--hostport=") + two_word_flags+=("--hostport") + local_nonpersistent_flags+=("--hostport=") + flags+=("--image=") + two_word_flags+=("--image") + local_nonpersistent_flags+=("--image=") + flags+=("--image-pull-policy=") + two_word_flags+=("--image-pull-policy") + local_nonpersistent_flags+=("--image-pull-policy=") + flags+=("--kustomize=") + two_word_flags+=("--kustomize") + two_word_flags+=("-k") + local_nonpersistent_flags+=("--kustomize=") + flags+=("--labels=") + two_word_flags+=("--labels") + two_word_flags+=("-l") + local_nonpersistent_flags+=("--labels=") + flags+=("--leave-stdin-open") + local_nonpersistent_flags+=("--leave-stdin-open") + flags+=("--limits=") + two_word_flags+=("--limits") + local_nonpersistent_flags+=("--limits=") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--overrides=") + two_word_flags+=("--overrides") + local_nonpersistent_flags+=("--overrides=") + flags+=("--pod-running-timeout=") + two_word_flags+=("--pod-running-timeout") + local_nonpersistent_flags+=("--pod-running-timeout=") + flags+=("--port=") + two_word_flags+=("--port") + local_nonpersistent_flags+=("--port=") + flags+=("--quiet") + local_nonpersistent_flags+=("--quiet") + flags+=("--record") + local_nonpersistent_flags+=("--record") + flags+=("--recursive") + flags+=("-R") + local_nonpersistent_flags+=("--recursive") + flags+=("--requests=") + two_word_flags+=("--requests") + local_nonpersistent_flags+=("--requests=") + flags+=("--restart=") + two_word_flags+=("--restart") + local_nonpersistent_flags+=("--restart=") + flags+=("--rm") + local_nonpersistent_flags+=("--rm") + flags+=("--save-config") + local_nonpersistent_flags+=("--save-config") + flags+=("--serviceaccount=") + two_word_flags+=("--serviceaccount") + local_nonpersistent_flags+=("--serviceaccount=") + flags+=("--stdin") + flags+=("-i") + local_nonpersistent_flags+=("--stdin") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--timeout=") + two_word_flags+=("--timeout") + local_nonpersistent_flags+=("--timeout=") + flags+=("--tty") + flags+=("-t") + local_nonpersistent_flags+=("--tty") + flags+=("--wait") + local_nonpersistent_flags+=("--wait") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_flag+=("--image=") + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_scale() +{ + last_command="kubectl_scale" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--all") + local_nonpersistent_flags+=("--all") + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--current-replicas=") + two_word_flags+=("--current-replicas") + local_nonpersistent_flags+=("--current-replicas=") + flags+=("--filename=") + two_word_flags+=("--filename") + flags_with_completion+=("--filename") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + local_nonpersistent_flags+=("--filename=") + flags+=("--kustomize=") + two_word_flags+=("--kustomize") + two_word_flags+=("-k") + local_nonpersistent_flags+=("--kustomize=") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--record") + local_nonpersistent_flags+=("--record") + flags+=("--recursive") + flags+=("-R") + local_nonpersistent_flags+=("--recursive") + flags+=("--replicas=") + two_word_flags+=("--replicas") + local_nonpersistent_flags+=("--replicas=") + flags+=("--resource-version=") + two_word_flags+=("--resource-version") + local_nonpersistent_flags+=("--resource-version=") + flags+=("--selector=") + two_word_flags+=("--selector") + two_word_flags+=("-l") + local_nonpersistent_flags+=("--selector=") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--timeout=") + two_word_flags+=("--timeout") + local_nonpersistent_flags+=("--timeout=") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_flag+=("--replicas=") + must_have_one_noun=() + must_have_one_noun+=("deployment") + must_have_one_noun+=("replicaset") + must_have_one_noun+=("replicationcontroller") + must_have_one_noun+=("statefulset") + noun_aliases=() +} + +_kubectl_set_env() +{ + last_command="kubectl_set_env" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--all") + local_nonpersistent_flags+=("--all") + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--containers=") + two_word_flags+=("--containers") + two_word_flags+=("-c") + local_nonpersistent_flags+=("--containers=") + flags+=("--dry-run") + local_nonpersistent_flags+=("--dry-run") + flags+=("--env=") + two_word_flags+=("--env") + two_word_flags+=("-e") + local_nonpersistent_flags+=("--env=") + flags+=("--filename=") + two_word_flags+=("--filename") + flags_with_completion+=("--filename") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + local_nonpersistent_flags+=("--filename=") + flags+=("--from=") + two_word_flags+=("--from") + local_nonpersistent_flags+=("--from=") + flags+=("--keys=") + two_word_flags+=("--keys") + local_nonpersistent_flags+=("--keys=") + flags+=("--kustomize=") + two_word_flags+=("--kustomize") + two_word_flags+=("-k") + local_nonpersistent_flags+=("--kustomize=") + flags+=("--list") + local_nonpersistent_flags+=("--list") + flags+=("--local") + local_nonpersistent_flags+=("--local") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--overwrite") + local_nonpersistent_flags+=("--overwrite") + flags+=("--prefix=") + two_word_flags+=("--prefix") + local_nonpersistent_flags+=("--prefix=") + flags+=("--recursive") + flags+=("-R") + local_nonpersistent_flags+=("--recursive") + flags+=("--resolve") + local_nonpersistent_flags+=("--resolve") + flags+=("--selector=") + two_word_flags+=("--selector") + two_word_flags+=("-l") + local_nonpersistent_flags+=("--selector=") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_set_image() +{ + last_command="kubectl_set_image" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--all") + local_nonpersistent_flags+=("--all") + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--dry-run") + local_nonpersistent_flags+=("--dry-run") + flags+=("--filename=") + two_word_flags+=("--filename") + flags_with_completion+=("--filename") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + local_nonpersistent_flags+=("--filename=") + flags+=("--kustomize=") + two_word_flags+=("--kustomize") + two_word_flags+=("-k") + local_nonpersistent_flags+=("--kustomize=") + flags+=("--local") + local_nonpersistent_flags+=("--local") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--record") + local_nonpersistent_flags+=("--record") + flags+=("--recursive") + flags+=("-R") + local_nonpersistent_flags+=("--recursive") + flags+=("--selector=") + two_word_flags+=("--selector") + two_word_flags+=("-l") + local_nonpersistent_flags+=("--selector=") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_set_resources() +{ + last_command="kubectl_set_resources" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--all") + local_nonpersistent_flags+=("--all") + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--containers=") + two_word_flags+=("--containers") + two_word_flags+=("-c") + local_nonpersistent_flags+=("--containers=") + flags+=("--dry-run") + local_nonpersistent_flags+=("--dry-run") + flags+=("--filename=") + two_word_flags+=("--filename") + flags_with_completion+=("--filename") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + local_nonpersistent_flags+=("--filename=") + flags+=("--kustomize=") + two_word_flags+=("--kustomize") + two_word_flags+=("-k") + local_nonpersistent_flags+=("--kustomize=") + flags+=("--limits=") + two_word_flags+=("--limits") + local_nonpersistent_flags+=("--limits=") + flags+=("--local") + local_nonpersistent_flags+=("--local") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--record") + local_nonpersistent_flags+=("--record") + flags+=("--recursive") + flags+=("-R") + local_nonpersistent_flags+=("--recursive") + flags+=("--requests=") + two_word_flags+=("--requests") + local_nonpersistent_flags+=("--requests=") + flags+=("--selector=") + two_word_flags+=("--selector") + two_word_flags+=("-l") + local_nonpersistent_flags+=("--selector=") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_set_selector() +{ + last_command="kubectl_set_selector" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--all") + local_nonpersistent_flags+=("--all") + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--dry-run") + local_nonpersistent_flags+=("--dry-run") + flags+=("--filename=") + two_word_flags+=("--filename") + flags_with_completion+=("--filename") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + local_nonpersistent_flags+=("--filename=") + flags+=("--local") + local_nonpersistent_flags+=("--local") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--record") + local_nonpersistent_flags+=("--record") + flags+=("--recursive") + flags+=("-R") + local_nonpersistent_flags+=("--recursive") + flags+=("--resource-version=") + two_word_flags+=("--resource-version") + local_nonpersistent_flags+=("--resource-version=") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_set_serviceaccount() +{ + last_command="kubectl_set_serviceaccount" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--all") + local_nonpersistent_flags+=("--all") + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--dry-run") + local_nonpersistent_flags+=("--dry-run") + flags+=("--filename=") + two_word_flags+=("--filename") + flags_with_completion+=("--filename") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + local_nonpersistent_flags+=("--filename=") + flags+=("--kustomize=") + two_word_flags+=("--kustomize") + two_word_flags+=("-k") + local_nonpersistent_flags+=("--kustomize=") + flags+=("--local") + local_nonpersistent_flags+=("--local") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--record") + local_nonpersistent_flags+=("--record") + flags+=("--recursive") + flags+=("-R") + local_nonpersistent_flags+=("--recursive") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_set_subject() +{ + last_command="kubectl_set_subject" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--all") + local_nonpersistent_flags+=("--all") + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--dry-run") + local_nonpersistent_flags+=("--dry-run") + flags+=("--filename=") + two_word_flags+=("--filename") + flags_with_completion+=("--filename") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + local_nonpersistent_flags+=("--filename=") + flags+=("--group=") + two_word_flags+=("--group") + local_nonpersistent_flags+=("--group=") + flags+=("--kustomize=") + two_word_flags+=("--kustomize") + two_word_flags+=("-k") + local_nonpersistent_flags+=("--kustomize=") + flags+=("--local") + local_nonpersistent_flags+=("--local") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--recursive") + flags+=("-R") + local_nonpersistent_flags+=("--recursive") + flags+=("--selector=") + two_word_flags+=("--selector") + two_word_flags+=("-l") + local_nonpersistent_flags+=("--selector=") + flags+=("--serviceaccount=") + two_word_flags+=("--serviceaccount") + local_nonpersistent_flags+=("--serviceaccount=") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_set() +{ + last_command="kubectl_set" + + command_aliases=() + + commands=() + commands+=("env") + commands+=("image") + commands+=("resources") + commands+=("selector") + commands+=("serviceaccount") + if [[ -z "${BASH_VERSION}" || "${BASH_VERSINFO[0]}" -gt 3 ]]; then + command_aliases+=("sa") + aliashash["sa"]="serviceaccount" + fi + commands+=("subject") + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_taint() +{ + last_command="kubectl_taint" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--all") + local_nonpersistent_flags+=("--all") + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--dry-run") + local_nonpersistent_flags+=("--dry-run") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--overwrite") + local_nonpersistent_flags+=("--overwrite") + flags+=("--selector=") + two_word_flags+=("--selector") + two_word_flags+=("-l") + local_nonpersistent_flags+=("--selector=") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--validate") + local_nonpersistent_flags+=("--validate") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + must_have_one_noun+=("node") + noun_aliases=() +} + +_kubectl_top_node() +{ + last_command="kubectl_top_node" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--heapster-namespace=") + two_word_flags+=("--heapster-namespace") + local_nonpersistent_flags+=("--heapster-namespace=") + flags+=("--heapster-port=") + two_word_flags+=("--heapster-port") + local_nonpersistent_flags+=("--heapster-port=") + flags+=("--heapster-scheme=") + two_word_flags+=("--heapster-scheme") + local_nonpersistent_flags+=("--heapster-scheme=") + flags+=("--heapster-service=") + two_word_flags+=("--heapster-service") + local_nonpersistent_flags+=("--heapster-service=") + flags+=("--no-headers") + local_nonpersistent_flags+=("--no-headers") + flags+=("--selector=") + two_word_flags+=("--selector") + two_word_flags+=("-l") + local_nonpersistent_flags+=("--selector=") + flags+=("--sort-by=") + two_word_flags+=("--sort-by") + local_nonpersistent_flags+=("--sort-by=") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_top_pod() +{ + last_command="kubectl_top_pod" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--all-namespaces") + flags+=("-A") + local_nonpersistent_flags+=("--all-namespaces") + flags+=("--containers") + local_nonpersistent_flags+=("--containers") + flags+=("--heapster-namespace=") + two_word_flags+=("--heapster-namespace") + local_nonpersistent_flags+=("--heapster-namespace=") + flags+=("--heapster-port=") + two_word_flags+=("--heapster-port") + local_nonpersistent_flags+=("--heapster-port=") + flags+=("--heapster-scheme=") + two_word_flags+=("--heapster-scheme") + local_nonpersistent_flags+=("--heapster-scheme=") + flags+=("--heapster-service=") + two_word_flags+=("--heapster-service") + local_nonpersistent_flags+=("--heapster-service=") + flags+=("--no-headers") + local_nonpersistent_flags+=("--no-headers") + flags+=("--selector=") + two_word_flags+=("--selector") + two_word_flags+=("-l") + local_nonpersistent_flags+=("--selector=") + flags+=("--sort-by=") + two_word_flags+=("--sort-by") + local_nonpersistent_flags+=("--sort-by=") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_top() +{ + last_command="kubectl_top" + + command_aliases=() + + commands=() + commands+=("node") + if [[ -z "${BASH_VERSION}" || "${BASH_VERSINFO[0]}" -gt 3 ]]; then + command_aliases+=("no") + aliashash["no"]="node" + command_aliases+=("nodes") + aliashash["nodes"]="node" + fi + commands+=("pod") + if [[ -z "${BASH_VERSION}" || "${BASH_VERSINFO[0]}" -gt 3 ]]; then + command_aliases+=("po") + aliashash["po"]="pod" + command_aliases+=("pods") + aliashash["pods"]="pod" + fi + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_uncordon() +{ + last_command="kubectl_uncordon" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--dry-run") + local_nonpersistent_flags+=("--dry-run") + flags+=("--selector=") + two_word_flags+=("--selector") + two_word_flags+=("-l") + local_nonpersistent_flags+=("--selector=") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_version() +{ + last_command="kubectl_version" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--client") + local_nonpersistent_flags+=("--client") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--short") + local_nonpersistent_flags+=("--short") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_wait() +{ + last_command="kubectl_wait" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--all") + local_nonpersistent_flags+=("--all") + flags+=("--all-namespaces") + flags+=("-A") + local_nonpersistent_flags+=("--all-namespaces") + flags+=("--allow-missing-template-keys") + local_nonpersistent_flags+=("--allow-missing-template-keys") + flags+=("--field-selector=") + two_word_flags+=("--field-selector") + local_nonpersistent_flags+=("--field-selector=") + flags+=("--filename=") + two_word_flags+=("--filename") + flags_with_completion+=("--filename") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__kubectl_handle_filename_extension_flag json|yaml|yml") + local_nonpersistent_flags+=("--filename=") + flags+=("--for=") + two_word_flags+=("--for") + local_nonpersistent_flags+=("--for=") + flags+=("--local") + local_nonpersistent_flags+=("--local") + flags+=("--output=") + two_word_flags+=("--output") + two_word_flags+=("-o") + local_nonpersistent_flags+=("--output=") + flags+=("--recursive") + flags+=("-R") + local_nonpersistent_flags+=("--recursive") + flags+=("--selector=") + two_word_flags+=("--selector") + two_word_flags+=("-l") + local_nonpersistent_flags+=("--selector=") + flags+=("--template=") + two_word_flags+=("--template") + flags_with_completion+=("--template") + flags_completion+=("_filedir") + local_nonpersistent_flags+=("--template=") + flags+=("--timeout=") + two_word_flags+=("--timeout") + local_nonpersistent_flags+=("--timeout=") + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +_kubectl_root_command() +{ + last_command="kubectl" + + command_aliases=() + + commands=() + commands+=("alpha") + commands+=("annotate") + commands+=("api-resources") + commands+=("api-versions") + commands+=("apply") + commands+=("attach") + commands+=("auth") + commands+=("autoscale") + commands+=("certificate") + commands+=("cluster-info") + commands+=("completion") + commands+=("config") + commands+=("convert") + commands+=("cordon") + commands+=("cp") + commands+=("create") + commands+=("delete") + commands+=("describe") + commands+=("diff") + commands+=("drain") + commands+=("edit") + commands+=("exec") + commands+=("explain") + commands+=("expose") + commands+=("get") + commands+=("kustomize") + commands+=("label") + commands+=("logs") + commands+=("options") + commands+=("patch") + commands+=("plugin") + commands+=("port-forward") + commands+=("proxy") + commands+=("replace") + commands+=("rollout") + commands+=("run") + commands+=("scale") + commands+=("set") + commands+=("taint") + commands+=("top") + commands+=("uncordon") + commands+=("version") + commands+=("wait") + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--add-dir-header") + flags+=("--alsologtostderr") + flags+=("--as=") + two_word_flags+=("--as") + flags+=("--as-group=") + two_word_flags+=("--as-group") + flags+=("--cache-dir=") + two_word_flags+=("--cache-dir") + flags+=("--certificate-authority=") + two_word_flags+=("--certificate-authority") + flags+=("--client-certificate=") + two_word_flags+=("--client-certificate") + flags+=("--client-key=") + two_word_flags+=("--client-key") + flags+=("--cluster=") + two_word_flags+=("--cluster") + flags_with_completion+=("--cluster") + flags_completion+=("__kubectl_config_get_clusters") + flags+=("--context=") + two_word_flags+=("--context") + flags_with_completion+=("--context") + flags_completion+=("__kubectl_config_get_contexts") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + two_word_flags+=("--kubeconfig") + flags+=("--log-backtrace-at=") + two_word_flags+=("--log-backtrace-at") + flags+=("--log-dir=") + two_word_flags+=("--log-dir") + flags+=("--log-file=") + two_word_flags+=("--log-file") + flags+=("--log-file-max-size=") + two_word_flags+=("--log-file-max-size") + flags+=("--log-flush-frequency=") + two_word_flags+=("--log-flush-frequency") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + two_word_flags+=("--namespace") + flags_with_completion+=("--namespace") + flags_completion+=("__kubectl_get_resource_namespace") + two_word_flags+=("-n") + flags_with_completion+=("-n") + flags_completion+=("__kubectl_get_resource_namespace") + flags+=("--password=") + two_word_flags+=("--password") + flags+=("--profile=") + two_word_flags+=("--profile") + flags+=("--profile-output=") + two_word_flags+=("--profile-output") + flags+=("--request-timeout=") + two_word_flags+=("--request-timeout") + flags+=("--server=") + two_word_flags+=("--server") + two_word_flags+=("-s") + flags+=("--skip-headers") + flags+=("--skip-log-headers") + flags+=("--stderrthreshold=") + two_word_flags+=("--stderrthreshold") + flags+=("--tls-server-name=") + two_word_flags+=("--tls-server-name") + flags+=("--token=") + two_word_flags+=("--token") + flags+=("--user=") + two_word_flags+=("--user") + flags_with_completion+=("--user") + flags_completion+=("__kubectl_config_get_users") + flags+=("--username=") + two_word_flags+=("--username") + flags+=("--v=") + two_word_flags+=("--v") + two_word_flags+=("-v") + flags+=("--vmodule=") + two_word_flags+=("--vmodule") + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + +__start_kubectl() +{ + local cur prev words cword + declare -A flaghash 2>/dev/null || : + declare -A aliashash 2>/dev/null || : + if declare -F _init_completion >/dev/null 2>&1; then + _init_completion -s || return + else + __kubectl_init_completion -n "=" || return + fi + + local c=0 + local flags=() + local two_word_flags=() + local local_nonpersistent_flags=() + local flags_with_completion=() + local flags_completion=() + local commands=("kubectl") + local must_have_one_flag=() + local must_have_one_noun=() + local last_command + local nouns=() + + __kubectl_handle_word +} + +if [[ $(type -t compopt) = "builtin" ]]; then + complete -o default -F __start_kubectl kubectl +else + complete -o default -o nospace -F __start_kubectl kubectl +fi + +# ex: ts=4 sw=4 et filetype=sh + +BASH_COMPLETION_EOF +} + +__kubectl_bash_source <(__kubectl_convert_bash_to_zsh) +_complete kubectl 2>/dev/null diff --git a/.zsh/completion/_rustup.zsh b/.zsh/completion/_rustup.zsh new file mode 100644 index 0000000..5e12337 --- /dev/null +++ b/.zsh/completion/_rustup.zsh @@ -0,0 +1,1143 @@ +#compdef rustup + +autoload -U is-at-least + +_rustup() { + typeset -A opt_args + typeset -a _arguments_options + local ret=1 + + if is-at-least 5.2; then + _arguments_options=(-s -S -C) + else + _arguments_options=(-s -C) + fi + + local context curcontext="$curcontext" state line + _arguments "${_arguments_options[@]}" \ +'-v[Enable verbose output]' \ +'--verbose[Enable verbose output]' \ +'(-v --verbose)-q[Disable progress output]' \ +'(-v --verbose)--quiet[Disable progress output]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'::+toolchain -- release channel (e.g. +stable) or custom toolchain to set override:_files' \ +":: :_rustup_commands" \ +"*::: :->rustup" \ +&& ret=0 + case $state in + (rustup) + words=($line[2] "${words[@]}") + (( CURRENT += 1 )) + curcontext="${curcontext%:*:*}:rustup-command-$line[2]:" + case $line[2] in + (dump-testament) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(show) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +":: :_rustup__show_commands" \ +"*::: :->show" \ +&& ret=0 +case $state in + (show) + words=($line[1] "${words[@]}") + (( CURRENT += 1 )) + curcontext="${curcontext%:*:*}:rustup-show-command-$line[1]:" + case $line[1] in + (active-toolchain) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(home) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(profile) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(keys) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(help) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; + esac + ;; +esac +;; +(install) +_arguments "${_arguments_options[@]}" \ +'--profile=[]: :(minimal default complete)' \ +'--no-self-update[Don'\''t perform self-update when running the `rustup install` command]' \ +'--force[Force an update, even if some components are missing]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ +&& ret=0 +;; +(uninstall) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ +&& ret=0 +;; +(update) +_arguments "${_arguments_options[@]}" \ +'--no-self-update[Don'\''t perform self update when running the `rustup update` command]' \ +'--force[Force an update, even if some components are missing]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'::toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ +&& ret=0 +;; +(check) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(default) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'::toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ +&& ret=0 +;; +(toolchain) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +":: :_rustup__toolchain_commands" \ +"*::: :->toolchain" \ +&& ret=0 +case $state in + (toolchain) + words=($line[1] "${words[@]}") + (( CURRENT += 1 )) + curcontext="${curcontext%:*:*}:rustup-toolchain-command-$line[1]:" + case $line[1] in + (list) +_arguments "${_arguments_options[@]}" \ +'-v[Enable verbose output with toolchain information]' \ +'--verbose[Enable verbose output with toolchain information]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(update) +_arguments "${_arguments_options[@]}" \ +'--profile=[]: :(minimal default complete)' \ +'*-c+[Add specific components on installation]' \ +'*--component=[Add specific components on installation]' \ +'*-t+[Add specific targets on installation]' \ +'*--target=[Add specific targets on installation]' \ +'--no-self-update[Don'\''t perform self update when running the`rustup toolchain install` command]' \ +'--force[Force an update, even if some components are missing]' \ +'--allow-downgrade[Allow rustup to downgrade the toolchain to satisfy your component choice]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ +&& ret=0 +;; +(add) +_arguments "${_arguments_options[@]}" \ +'--profile=[]: :(minimal default complete)' \ +'*-c+[Add specific components on installation]' \ +'*--component=[Add specific components on installation]' \ +'*-t+[Add specific targets on installation]' \ +'*--target=[Add specific targets on installation]' \ +'--no-self-update[Don'\''t perform self update when running the`rustup toolchain install` command]' \ +'--force[Force an update, even if some components are missing]' \ +'--allow-downgrade[Allow rustup to downgrade the toolchain to satisfy your component choice]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ +&& ret=0 +;; +(install) +_arguments "${_arguments_options[@]}" \ +'--profile=[]: :(minimal default complete)' \ +'*-c+[Add specific components on installation]' \ +'*--component=[Add specific components on installation]' \ +'*-t+[Add specific targets on installation]' \ +'*--target=[Add specific targets on installation]' \ +'--no-self-update[Don'\''t perform self update when running the`rustup toolchain install` command]' \ +'--force[Force an update, even if some components are missing]' \ +'--allow-downgrade[Allow rustup to downgrade the toolchain to satisfy your component choice]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ +&& ret=0 +;; +(remove) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ +&& ret=0 +;; +(uninstall) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ +&& ret=0 +;; +(link) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':toolchain -- Custom toolchain name:_files' \ +':path -- Path to the directory:_files' \ +&& ret=0 +;; +(help) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; + esac + ;; +esac +;; +(target) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +":: :_rustup__target_commands" \ +"*::: :->target" \ +&& ret=0 +case $state in + (target) + words=($line[1] "${words[@]}") + (( CURRENT += 1 )) + curcontext="${curcontext%:*:*}:rustup-target-command-$line[1]:" + case $line[1] in + (list) +_arguments "${_arguments_options[@]}" \ +'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ +'--installed[List only installed targets]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(install) +_arguments "${_arguments_options[@]}" \ +'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':target -- List of targets to install; "all" installs all available targets:_files' \ +&& ret=0 +;; +(add) +_arguments "${_arguments_options[@]}" \ +'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':target -- List of targets to install; "all" installs all available targets:_files' \ +&& ret=0 +;; +(uninstall) +_arguments "${_arguments_options[@]}" \ +'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':target:_files' \ +&& ret=0 +;; +(remove) +_arguments "${_arguments_options[@]}" \ +'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':target:_files' \ +&& ret=0 +;; +(help) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; + esac + ;; +esac +;; +(component) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +":: :_rustup__component_commands" \ +"*::: :->component" \ +&& ret=0 +case $state in + (component) + words=($line[1] "${words[@]}") + (( CURRENT += 1 )) + curcontext="${curcontext%:*:*}:rustup-component-command-$line[1]:" + case $line[1] in + (list) +_arguments "${_arguments_options[@]}" \ +'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ +'--installed[List only installed components]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(add) +_arguments "${_arguments_options[@]}" \ +'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ +'--target=[]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':component:_files' \ +&& ret=0 +;; +(remove) +_arguments "${_arguments_options[@]}" \ +'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ +'--target=[]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':component:_files' \ +&& ret=0 +;; +(help) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; + esac + ;; +esac +;; +(override) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +":: :_rustup__override_commands" \ +"*::: :->override" \ +&& ret=0 +case $state in + (override) + words=($line[1] "${words[@]}") + (( CURRENT += 1 )) + curcontext="${curcontext%:*:*}:rustup-override-command-$line[1]:" + case $line[1] in + (list) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(add) +_arguments "${_arguments_options[@]}" \ +'--path=[Path to the directory]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ +&& ret=0 +;; +(set) +_arguments "${_arguments_options[@]}" \ +'--path=[Path to the directory]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ +&& ret=0 +;; +(remove) +_arguments "${_arguments_options[@]}" \ +'--path=[Path to the directory]' \ +'--nonexistent[Remove override toolchain for all nonexistent directories]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(unset) +_arguments "${_arguments_options[@]}" \ +'--path=[Path to the directory]' \ +'--nonexistent[Remove override toolchain for all nonexistent directories]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(help) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; + esac + ;; +esac +;; +(run) +_arguments "${_arguments_options[@]}" \ +'--install[Install the requested toolchain if needed]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ +':command:_files' \ +&& ret=0 +;; +(which) +_arguments "${_arguments_options[@]}" \ +'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':command:_files' \ +&& ret=0 +;; +(docs) +_arguments "${_arguments_options[@]}" \ +'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ +'--path[Only print the path to the documentation]' \ +'--alloc[The Rust core allocation and collections library]' \ +'--book[The Rust Programming Language book]' \ +'--cargo[The Cargo Book]' \ +'--core[The Rust Core Library]' \ +'--edition-guide[The Rust Edition Guide]' \ +'--nomicon[The Dark Arts of Advanced and Unsafe Rust Programming]' \ +'--proc_macro[A support library for macro authors when defining new macros]' \ +'--reference[The Rust Reference]' \ +'--rust-by-example[A collection of runnable examples that illustrate various Rust concepts and standard libraries]' \ +'--rustc[The compiler for the Rust programming language]' \ +'--rustdoc[Generate documentation for Rust projects]' \ +'--std[Standard library API documentation]' \ +'--test[Support code for rustc'\''s built in unit-test and micro-benchmarking framework]' \ +'--unstable-book[The Unstable Book]' \ +'--embedded-book[The Embedded Rust Book]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'::topic -- Topic such as 'core', 'fn', 'usize', 'eprintln!', 'core::arch', 'alloc::format!', 'std::fs', 'std::fs::read_dir', 'std::io::Bytes', 'std::iter::Sum', 'std::io::error::Result' etc...:_files' \ +&& ret=0 +;; +(doc) +_arguments "${_arguments_options[@]}" \ +'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ +'--path[Only print the path to the documentation]' \ +'--alloc[The Rust core allocation and collections library]' \ +'--book[The Rust Programming Language book]' \ +'--cargo[The Cargo Book]' \ +'--core[The Rust Core Library]' \ +'--edition-guide[The Rust Edition Guide]' \ +'--nomicon[The Dark Arts of Advanced and Unsafe Rust Programming]' \ +'--proc_macro[A support library for macro authors when defining new macros]' \ +'--reference[The Rust Reference]' \ +'--rust-by-example[A collection of runnable examples that illustrate various Rust concepts and standard libraries]' \ +'--rustc[The compiler for the Rust programming language]' \ +'--rustdoc[Generate documentation for Rust projects]' \ +'--std[Standard library API documentation]' \ +'--test[Support code for rustc'\''s built in unit-test and micro-benchmarking framework]' \ +'--unstable-book[The Unstable Book]' \ +'--embedded-book[The Embedded Rust Book]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'::topic -- Topic such as 'core', 'fn', 'usize', 'eprintln!', 'core::arch', 'alloc::format!', 'std::fs', 'std::fs::read_dir', 'std::io::Bytes', 'std::iter::Sum', 'std::io::error::Result' etc...:_files' \ +&& ret=0 +;; +(man) +_arguments "${_arguments_options[@]}" \ +'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':command:_files' \ +&& ret=0 +;; +(self) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +":: :_rustup__self_commands" \ +"*::: :->self" \ +&& ret=0 +case $state in + (self) + words=($line[1] "${words[@]}") + (( CURRENT += 1 )) + curcontext="${curcontext%:*:*}:rustup-self-command-$line[1]:" + case $line[1] in + (update) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(uninstall) +_arguments "${_arguments_options[@]}" \ +'-y[]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(upgrade-data) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(help) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; + esac + ;; +esac +;; +(set) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +":: :_rustup__set_commands" \ +"*::: :->set" \ +&& ret=0 +case $state in + (set) + words=($line[1] "${words[@]}") + (( CURRENT += 1 )) + curcontext="${curcontext%:*:*}:rustup-set-command-$line[1]:" + case $line[1] in + (default-host) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':host_triple:_files' \ +&& ret=0 +;; +(profile) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':profile-name:(minimal default complete)' \ +&& ret=0 +;; +(help) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; + esac + ;; +esac +;; +(completions) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'::shell:(zsh bash fish powershell elvish)' \ +'::command:(rustup cargo)' \ +&& ret=0 +;; +(help) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; + esac + ;; +esac +} + +(( $+functions[_rustup_commands] )) || +_rustup_commands() { + local commands; commands=( + "dump-testament:Dump information about the build" \ +"show:Show the active and installed toolchains or profiles" \ +"install:Update Rust toolchains" \ +"uninstall:Uninstall Rust toolchains" \ +"update:Update Rust toolchains and rustup" \ +"check:Check for updates to Rust toolchains" \ +"default:Set the default toolchain" \ +"toolchain:Modify or query the installed toolchains" \ +"target:Modify a toolchain's supported targets" \ +"component:Modify a toolchain's installed components" \ +"override:Modify directory toolchain overrides" \ +"run:Run a command with an environment configured for a given toolchain" \ +"which:Display which binary will be run for a given command" \ +"doc:Open the documentation for the current toolchain" \ +"man:View the man page for a given command" \ +"self:Modify the rustup installation" \ +"set:Alter rustup settings" \ +"completions:Generate tab-completion scripts for your shell" \ +"help:Prints this message or the help of the given subcommand(s)" \ + ) + _describe -t commands 'rustup commands' commands "$@" +} +(( $+functions[_rustup__show__active-toolchain_commands] )) || +_rustup__show__active-toolchain_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup show active-toolchain commands' commands "$@" +} +(( $+functions[_rustup__add_commands] )) || +_rustup__add_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup add commands' commands "$@" +} +(( $+functions[_rustup__component__add_commands] )) || +_rustup__component__add_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup component add commands' commands "$@" +} +(( $+functions[_rustup__override__add_commands] )) || +_rustup__override__add_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup override add commands' commands "$@" +} +(( $+functions[_rustup__target__add_commands] )) || +_rustup__target__add_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup target add commands' commands "$@" +} +(( $+functions[_rustup__toolchain__add_commands] )) || +_rustup__toolchain__add_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup toolchain add commands' commands "$@" +} +(( $+functions[_rustup__check_commands] )) || +_rustup__check_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup check commands' commands "$@" +} +(( $+functions[_rustup__completions_commands] )) || +_rustup__completions_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup completions commands' commands "$@" +} +(( $+functions[_rustup__component_commands] )) || +_rustup__component_commands() { + local commands; commands=( + "list:List installed and available components" \ +"add:Add a component to a Rust toolchain" \ +"remove:Remove a component from a Rust toolchain" \ +"help:Prints this message or the help of the given subcommand(s)" \ + ) + _describe -t commands 'rustup component commands' commands "$@" +} +(( $+functions[_rustup__default_commands] )) || +_rustup__default_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup default commands' commands "$@" +} +(( $+functions[_rustup__set__default-host_commands] )) || +_rustup__set__default-host_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup set default-host commands' commands "$@" +} +(( $+functions[_rustup__doc_commands] )) || +_rustup__doc_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup doc commands' commands "$@" +} +(( $+functions[_docs_commands] )) || +_docs_commands() { + local commands; commands=( + + ) + _describe -t commands 'docs commands' commands "$@" +} +(( $+functions[_rustup__docs_commands] )) || +_rustup__docs_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup docs commands' commands "$@" +} +(( $+functions[_rustup__dump-testament_commands] )) || +_rustup__dump-testament_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup dump-testament commands' commands "$@" +} +(( $+functions[_rustup__component__help_commands] )) || +_rustup__component__help_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup component help commands' commands "$@" +} +(( $+functions[_rustup__help_commands] )) || +_rustup__help_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup help commands' commands "$@" +} +(( $+functions[_rustup__override__help_commands] )) || +_rustup__override__help_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup override help commands' commands "$@" +} +(( $+functions[_rustup__self__help_commands] )) || +_rustup__self__help_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup self help commands' commands "$@" +} +(( $+functions[_rustup__set__help_commands] )) || +_rustup__set__help_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup set help commands' commands "$@" +} +(( $+functions[_rustup__show__help_commands] )) || +_rustup__show__help_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup show help commands' commands "$@" +} +(( $+functions[_rustup__target__help_commands] )) || +_rustup__target__help_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup target help commands' commands "$@" +} +(( $+functions[_rustup__toolchain__help_commands] )) || +_rustup__toolchain__help_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup toolchain help commands' commands "$@" +} +(( $+functions[_rustup__show__home_commands] )) || +_rustup__show__home_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup show home commands' commands "$@" +} +(( $+functions[_rustup__install_commands] )) || +_rustup__install_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup install commands' commands "$@" +} +(( $+functions[_rustup__target__install_commands] )) || +_rustup__target__install_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup target install commands' commands "$@" +} +(( $+functions[_rustup__toolchain__install_commands] )) || +_rustup__toolchain__install_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup toolchain install commands' commands "$@" +} +(( $+functions[_rustup__show__keys_commands] )) || +_rustup__show__keys_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup show keys commands' commands "$@" +} +(( $+functions[_rustup__toolchain__link_commands] )) || +_rustup__toolchain__link_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup toolchain link commands' commands "$@" +} +(( $+functions[_rustup__component__list_commands] )) || +_rustup__component__list_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup component list commands' commands "$@" +} +(( $+functions[_rustup__override__list_commands] )) || +_rustup__override__list_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup override list commands' commands "$@" +} +(( $+functions[_rustup__target__list_commands] )) || +_rustup__target__list_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup target list commands' commands "$@" +} +(( $+functions[_rustup__toolchain__list_commands] )) || +_rustup__toolchain__list_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup toolchain list commands' commands "$@" +} +(( $+functions[_rustup__man_commands] )) || +_rustup__man_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup man commands' commands "$@" +} +(( $+functions[_rustup__override_commands] )) || +_rustup__override_commands() { + local commands; commands=( + "list:List directory toolchain overrides" \ +"set:Set the override toolchain for a directory" \ +"unset:Remove the override toolchain for a directory" \ +"help:Prints this message or the help of the given subcommand(s)" \ + ) + _describe -t commands 'rustup override commands' commands "$@" +} +(( $+functions[_rustup__set__profile_commands] )) || +_rustup__set__profile_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup set profile commands' commands "$@" +} +(( $+functions[_rustup__show__profile_commands] )) || +_rustup__show__profile_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup show profile commands' commands "$@" +} +(( $+functions[_rustup__component__remove_commands] )) || +_rustup__component__remove_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup component remove commands' commands "$@" +} +(( $+functions[_rustup__override__remove_commands] )) || +_rustup__override__remove_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup override remove commands' commands "$@" +} +(( $+functions[_rustup__remove_commands] )) || +_rustup__remove_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup remove commands' commands "$@" +} +(( $+functions[_rustup__target__remove_commands] )) || +_rustup__target__remove_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup target remove commands' commands "$@" +} +(( $+functions[_rustup__toolchain__remove_commands] )) || +_rustup__toolchain__remove_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup toolchain remove commands' commands "$@" +} +(( $+functions[_rustup__run_commands] )) || +_rustup__run_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup run commands' commands "$@" +} +(( $+functions[_rustup__self_commands] )) || +_rustup__self_commands() { + local commands; commands=( + "update:Download and install updates to rustup" \ +"uninstall:Uninstall rustup." \ +"upgrade-data:Upgrade the internal data format." \ +"help:Prints this message or the help of the given subcommand(s)" \ + ) + _describe -t commands 'rustup self commands' commands "$@" +} +(( $+functions[_rustup__override__set_commands] )) || +_rustup__override__set_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup override set commands' commands "$@" +} +(( $+functions[_rustup__set_commands] )) || +_rustup__set_commands() { + local commands; commands=( + "default-host:The triple used to identify toolchains when not specified" \ +"profile:The default components installed" \ +"help:Prints this message or the help of the given subcommand(s)" \ + ) + _describe -t commands 'rustup set commands' commands "$@" +} +(( $+functions[_rustup__show_commands] )) || +_rustup__show_commands() { + local commands; commands=( + "active-toolchain:Show the active toolchain" \ +"home:Display the computed value of RUSTUP_HOME" \ +"profile:Show the current profile" \ +"keys:Display the known PGP keys" \ +"help:Prints this message or the help of the given subcommand(s)" \ + ) + _describe -t commands 'rustup show commands' commands "$@" +} +(( $+functions[_rustup__target_commands] )) || +_rustup__target_commands() { + local commands; commands=( + "list:List installed and available targets" \ +"add:Add a target to a Rust toolchain" \ +"remove:Remove a target from a Rust toolchain" \ +"help:Prints this message or the help of the given subcommand(s)" \ + ) + _describe -t commands 'rustup target commands' commands "$@" +} +(( $+functions[_rustup__toolchain_commands] )) || +_rustup__toolchain_commands() { + local commands; commands=( + "list:List installed toolchains" \ +"install:Install or update a given toolchain" \ +"uninstall:Uninstall a toolchain" \ +"link:Create a custom toolchain by symlinking to a directory" \ +"help:Prints this message or the help of the given subcommand(s)" \ + ) + _describe -t commands 'rustup toolchain commands' commands "$@" +} +(( $+functions[_rustup__self__uninstall_commands] )) || +_rustup__self__uninstall_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup self uninstall commands' commands "$@" +} +(( $+functions[_rustup__target__uninstall_commands] )) || +_rustup__target__uninstall_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup target uninstall commands' commands "$@" +} +(( $+functions[_rustup__toolchain__uninstall_commands] )) || +_rustup__toolchain__uninstall_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup toolchain uninstall commands' commands "$@" +} +(( $+functions[_rustup__uninstall_commands] )) || +_rustup__uninstall_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup uninstall commands' commands "$@" +} +(( $+functions[_rustup__override__unset_commands] )) || +_rustup__override__unset_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup override unset commands' commands "$@" +} +(( $+functions[_rustup__self__update_commands] )) || +_rustup__self__update_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup self update commands' commands "$@" +} +(( $+functions[_rustup__toolchain__update_commands] )) || +_rustup__toolchain__update_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup toolchain update commands' commands "$@" +} +(( $+functions[_rustup__update_commands] )) || +_rustup__update_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup update commands' commands "$@" +} +(( $+functions[_rustup__self__upgrade-data_commands] )) || +_rustup__self__upgrade-data_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup self upgrade-data commands' commands "$@" +} +(( $+functions[_rustup__which_commands] )) || +_rustup__which_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup which commands' commands "$@" +} + +_rustup "$@"
\ No newline at end of file diff --git a/.zsh/completion/git-completion.bash b/.zsh/completion/git-completion.bash new file mode 100644 index 0000000..463a312 --- /dev/null +++ b/.zsh/completion/git-completion.bash @@ -0,0 +1,3516 @@ +# bash/zsh completion support for core Git. +# +# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org> +# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/). +# Distributed under the GNU General Public License, version 2.0. +# +# The contained completion routines provide support for completing: +# +# *) local and remote branch names +# *) local and remote tag names +# *) .git/remotes file names +# *) git 'subcommands' +# *) git email aliases for git-send-email +# *) tree paths within 'ref:path/to/file' expressions +# *) file paths within current working directory and index +# *) common --long-options +# +# To use these routines: +# +# 1) Copy this file to somewhere (e.g. ~/.git-completion.bash). +# 2) Add the following line to your .bashrc/.zshrc: +# source ~/.git-completion.bash +# 3) Consider changing your PS1 to also show the current branch, +# see git-prompt.sh for details. +# +# If you use complex aliases of form '!f() { ... }; f', you can use the null +# command ':' as the first command in the function body to declare the desired +# completion style. For example '!f() { : git commit ; ... }; f' will +# tell the completion to use commit completion. This also works with aliases +# of form "!sh -c '...'". For example, "!sh -c ': git commit ; ... '". +# +# Compatible with bash 3.2.57. +# +# You can set the following environment variables to influence the behavior of +# the completion routines: +# +# GIT_COMPLETION_CHECKOUT_NO_GUESS +# +# When set to "1", do not include "DWIM" suggestions in git-checkout +# and git-switch completion (e.g., completing "foo" when "origin/foo" +# exists). +# +# GIT_COMPLETION_SHOW_ALL +# +# When set to "1" suggest all options, including options which are +# typically hidden (e.g. '--allow-empty' for 'git commit'). + +case "$COMP_WORDBREAKS" in +*:*) : great ;; +*) COMP_WORDBREAKS="$COMP_WORDBREAKS:" +esac + +# Discovers the path to the git repository taking any '--git-dir=<path>' and +# '-C <path>' options into account and stores it in the $__git_repo_path +# variable. +__git_find_repo_path () +{ + if [ -n "${__git_repo_path-}" ]; then + # we already know where it is + return + fi + + if [ -n "${__git_C_args-}" ]; then + __git_repo_path="$(git "${__git_C_args[@]}" \ + ${__git_dir:+--git-dir="$__git_dir"} \ + rev-parse --absolute-git-dir 2>/dev/null)" + elif [ -n "${__git_dir-}" ]; then + test -d "$__git_dir" && + __git_repo_path="$__git_dir" + elif [ -n "${GIT_DIR-}" ]; then + test -d "${GIT_DIR-}" && + __git_repo_path="$GIT_DIR" + elif [ -d .git ]; then + __git_repo_path=.git + else + __git_repo_path="$(git rev-parse --git-dir 2>/dev/null)" + fi +} + +# Deprecated: use __git_find_repo_path() and $__git_repo_path instead +# __gitdir accepts 0 or 1 arguments (i.e., location) +# returns location of .git repo +__gitdir () +{ + if [ -z "${1-}" ]; then + __git_find_repo_path || return 1 + echo "$__git_repo_path" + elif [ -d "$1/.git" ]; then + echo "$1/.git" + else + echo "$1" + fi +} + +# Runs git with all the options given as argument, respecting any +# '--git-dir=<path>' and '-C <path>' options present on the command line +__git () +{ + git ${__git_C_args:+"${__git_C_args[@]}"} \ + ${__git_dir:+--git-dir="$__git_dir"} "$@" 2>/dev/null +} + +# Removes backslash escaping, single quotes and double quotes from a word, +# stores the result in the variable $dequoted_word. +# 1: The word to dequote. +__git_dequote () +{ + local rest="$1" len ch + + dequoted_word="" + + while test -n "$rest"; do + len=${#dequoted_word} + dequoted_word="$dequoted_word${rest%%[\\\'\"]*}" + rest="${rest:$((${#dequoted_word}-$len))}" + + case "${rest:0:1}" in + \\) + ch="${rest:1:1}" + case "$ch" in + $'\n') + ;; + *) + dequoted_word="$dequoted_word$ch" + ;; + esac + rest="${rest:2}" + ;; + \') + rest="${rest:1}" + len=${#dequoted_word} + dequoted_word="$dequoted_word${rest%%\'*}" + rest="${rest:$((${#dequoted_word}-$len+1))}" + ;; + \") + rest="${rest:1}" + while test -n "$rest" ; do + len=${#dequoted_word} + dequoted_word="$dequoted_word${rest%%[\\\"]*}" + rest="${rest:$((${#dequoted_word}-$len))}" + case "${rest:0:1}" in + \\) + ch="${rest:1:1}" + case "$ch" in + \"|\\|\$|\`) + dequoted_word="$dequoted_word$ch" + ;; + $'\n') + ;; + *) + dequoted_word="$dequoted_word\\$ch" + ;; + esac + rest="${rest:2}" + ;; + \") + rest="${rest:1}" + break + ;; + esac + done + ;; + esac + done +} + +# The following function is based on code from: +# +# bash_completion - programmable completion functions for bash 3.2+ +# +# Copyright © 2006-2008, Ian Macdonald <ian@caliban.org> +# © 2009-2010, Bash Completion Maintainers +# <bash-completion-devel@lists.alioth.debian.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see <http://www.gnu.org/licenses/>. +# +# The latest version of this software can be obtained here: +# +# http://bash-completion.alioth.debian.org/ +# +# RELEASE: 2.x + +# This function can be used to access a tokenized list of words +# on the command line: +# +# __git_reassemble_comp_words_by_ref '=:' +# if test "${words_[cword_-1]}" = -w +# then +# ... +# fi +# +# The argument should be a collection of characters from the list of +# word completion separators (COMP_WORDBREAKS) to treat as ordinary +# characters. +# +# This is roughly equivalent to going back in time and setting +# COMP_WORDBREAKS to exclude those characters. The intent is to +# make option types like --date=<type> and <rev>:<path> easy to +# recognize by treating each shell word as a single token. +# +# It is best not to set COMP_WORDBREAKS directly because the value is +# shared with other completion scripts. By the time the completion +# function gets called, COMP_WORDS has already been populated so local +# changes to COMP_WORDBREAKS have no effect. +# +# Output: words_, cword_, cur_. + +__git_reassemble_comp_words_by_ref() +{ + local exclude i j first + # Which word separators to exclude? + exclude="${1//[^$COMP_WORDBREAKS]}" + cword_=$COMP_CWORD + if [ -z "$exclude" ]; then + words_=("${COMP_WORDS[@]}") + return + fi + # List of word completion separators has shrunk; + # re-assemble words to complete. + for ((i=0, j=0; i < ${#COMP_WORDS[@]}; i++, j++)); do + # Append each nonempty word consisting of just + # word separator characters to the current word. + first=t + while + [ $i -gt 0 ] && + [ -n "${COMP_WORDS[$i]}" ] && + # word consists of excluded word separators + [ "${COMP_WORDS[$i]//[^$exclude]}" = "${COMP_WORDS[$i]}" ] + do + # Attach to the previous token, + # unless the previous token is the command name. + if [ $j -ge 2 ] && [ -n "$first" ]; then + ((j--)) + fi + first= + words_[$j]=${words_[j]}${COMP_WORDS[i]} + if [ $i = $COMP_CWORD ]; then + cword_=$j + fi + if (($i < ${#COMP_WORDS[@]} - 1)); then + ((i++)) + else + # Done. + return + fi + done + words_[$j]=${words_[j]}${COMP_WORDS[i]} + if [ $i = $COMP_CWORD ]; then + cword_=$j + fi + done +} + +if ! type _get_comp_words_by_ref >/dev/null 2>&1; then +_get_comp_words_by_ref () +{ + local exclude cur_ words_ cword_ + if [ "$1" = "-n" ]; then + exclude=$2 + shift 2 + fi + __git_reassemble_comp_words_by_ref "$exclude" + cur_=${words_[cword_]} + while [ $# -gt 0 ]; do + case "$1" in + cur) + cur=$cur_ + ;; + prev) + prev=${words_[$cword_-1]} + ;; + words) + words=("${words_[@]}") + ;; + cword) + cword=$cword_ + ;; + esac + shift + done +} +fi + +# Fills the COMPREPLY array with prefiltered words without any additional +# processing. +# Callers must take care of providing only words that match the current word +# to be completed and adding any prefix and/or suffix (trailing space!), if +# necessary. +# 1: List of newline-separated matching completion words, complete with +# prefix and suffix. +__gitcomp_direct () +{ + local IFS=$'\n' + + COMPREPLY=($1) +} + +# Similar to __gitcomp_direct, but appends to COMPREPLY instead. +# Callers must take care of providing only words that match the current word +# to be completed and adding any prefix and/or suffix (trailing space!), if +# necessary. +# 1: List of newline-separated matching completion words, complete with +# prefix and suffix. +__gitcomp_direct_append () +{ + local IFS=$'\n' + + COMPREPLY+=($1) +} + +__gitcompappend () +{ + local x i=${#COMPREPLY[@]} + for x in $1; do + if [[ "$x" == "$3"* ]]; then + COMPREPLY[i++]="$2$x$4" + fi + done +} + +__gitcompadd () +{ + COMPREPLY=() + __gitcompappend "$@" +} + +# Generates completion reply, appending a space to possible completion words, +# if necessary. +# It accepts 1 to 4 arguments: +# 1: List of possible completion words. +# 2: A prefix to be added to each possible completion word (optional). +# 3: Generate possible completion matches for this word (optional). +# 4: A suffix to be appended to each possible completion word (optional). +__gitcomp () +{ + local cur_="${3-$cur}" + + case "$cur_" in + --*=) + ;; + --no-*) + local c i=0 IFS=$' \t\n' + for c in $1; do + if [[ $c == "--" ]]; then + continue + fi + c="$c${4-}" + if [[ $c == "$cur_"* ]]; then + case $c in + --*=|*.) ;; + *) c="$c " ;; + esac + COMPREPLY[i++]="${2-}$c" + fi + done + ;; + *) + local c i=0 IFS=$' \t\n' + for c in $1; do + if [[ $c == "--" ]]; then + c="--no-...${4-}" + if [[ $c == "$cur_"* ]]; then + COMPREPLY[i++]="${2-}$c " + fi + break + fi + c="$c${4-}" + if [[ $c == "$cur_"* ]]; then + case $c in + *=|*.) ;; + *) c="$c " ;; + esac + COMPREPLY[i++]="${2-}$c" + fi + done + ;; + esac +} + +# Clear the variables caching builtins' options when (re-)sourcing +# the completion script. +if [[ -n ${ZSH_VERSION-} ]]; then + unset ${(M)${(k)parameters[@]}:#__gitcomp_builtin_*} 2>/dev/null +else + unset $(compgen -v __gitcomp_builtin_) +fi + +# This function is equivalent to +# +# __gitcomp "$(git xxx --git-completion-helper) ..." +# +# except that the output is cached. Accept 1-3 arguments: +# 1: the git command to execute, this is also the cache key +# 2: extra options to be added on top (e.g. negative forms) +# 3: options to be excluded +__gitcomp_builtin () +{ + # spaces must be replaced with underscore for multi-word + # commands, e.g. "git remote add" becomes remote_add. + local cmd="$1" + local incl="${2-}" + local excl="${3-}" + + local var=__gitcomp_builtin_"${cmd/-/_}" + local options + eval "options=\${$var-}" + + if [ -z "$options" ]; then + local completion_helper + if [ "$GIT_COMPLETION_SHOW_ALL" = "1" ]; then + completion_helper="--git-completion-helper-all" + else + completion_helper="--git-completion-helper" + fi + # leading and trailing spaces are significant to make + # option removal work correctly. + options=" $incl $(__git ${cmd/_/ } $completion_helper) " || return + + for i in $excl; do + options="${options/ $i / }" + done + eval "$var=\"$options\"" + fi + + __gitcomp "$options" +} + +# Variation of __gitcomp_nl () that appends to the existing list of +# completion candidates, COMPREPLY. +__gitcomp_nl_append () +{ + local IFS=$'\n' + __gitcompappend "$1" "${2-}" "${3-$cur}" "${4- }" +} + +# Generates completion reply from newline-separated possible completion words +# by appending a space to all of them. +# It accepts 1 to 4 arguments: +# 1: List of possible completion words, separated by a single newline. +# 2: A prefix to be added to each possible completion word (optional). +# 3: Generate possible completion matches for this word (optional). +# 4: A suffix to be appended to each possible completion word instead of +# the default space (optional). If specified but empty, nothing is +# appended. +__gitcomp_nl () +{ + COMPREPLY=() + __gitcomp_nl_append "$@" +} + +# Fills the COMPREPLY array with prefiltered paths without any additional +# processing. +# Callers must take care of providing only paths that match the current path +# to be completed and adding any prefix path components, if necessary. +# 1: List of newline-separated matching paths, complete with all prefix +# path components. +__gitcomp_file_direct () +{ + local IFS=$'\n' + + COMPREPLY=($1) + + # use a hack to enable file mode in bash < 4 + compopt -o filenames +o nospace 2>/dev/null || + compgen -f /non-existing-dir/ >/dev/null || + true +} + +# Generates completion reply with compgen from newline-separated possible +# completion filenames. +# It accepts 1 to 3 arguments: +# 1: List of possible completion filenames, separated by a single newline. +# 2: A directory prefix to be added to each possible completion filename +# (optional). +# 3: Generate possible completion matches for this word (optional). +__gitcomp_file () +{ + local IFS=$'\n' + + # XXX does not work when the directory prefix contains a tilde, + # since tilde expansion is not applied. + # This means that COMPREPLY will be empty and Bash default + # completion will be used. + __gitcompadd "$1" "${2-}" "${3-$cur}" "" + + # use a hack to enable file mode in bash < 4 + compopt -o filenames +o nospace 2>/dev/null || + compgen -f /non-existing-dir/ >/dev/null || + true +} + +# Execute 'git ls-files', unless the --committable option is specified, in +# which case it runs 'git diff-index' to find out the files that can be +# committed. It return paths relative to the directory specified in the first +# argument, and using the options specified in the second argument. +__git_ls_files_helper () +{ + if [ "$2" == "--committable" ]; then + __git -C "$1" -c core.quotePath=false diff-index \ + --name-only --relative HEAD -- "${3//\\/\\\\}*" + else + # NOTE: $2 is not quoted in order to support multiple options + __git -C "$1" -c core.quotePath=false ls-files \ + --exclude-standard $2 -- "${3//\\/\\\\}*" + fi +} + + +# __git_index_files accepts 1 or 2 arguments: +# 1: Options to pass to ls-files (required). +# 2: A directory path (optional). +# If provided, only files within the specified directory are listed. +# Sub directories are never recursed. Path must have a trailing +# slash. +# 3: List only paths matching this path component (optional). +__git_index_files () +{ + local root="$2" match="$3" + + __git_ls_files_helper "$root" "$1" "${match:-?}" | + awk -F / -v pfx="${2//\\/\\\\}" '{ + paths[$1] = 1 + } + END { + for (p in paths) { + if (substr(p, 1, 1) != "\"") { + # No special characters, easy! + print pfx p + continue + } + + # The path is quoted. + p = dequote(p) + if (p == "") + continue + + # Even when a directory name itself does not contain + # any special characters, it will still be quoted if + # any of its (stripped) trailing path components do. + # Because of this we may have seen the same directory + # both quoted and unquoted. + if (p in paths) + # We have seen the same directory unquoted, + # skip it. + continue + else + print pfx p + } + } + function dequote(p, bs_idx, out, esc, esc_idx, dec) { + # Skip opening double quote. + p = substr(p, 2) + + # Interpret backslash escape sequences. + while ((bs_idx = index(p, "\\")) != 0) { + out = out substr(p, 1, bs_idx - 1) + esc = substr(p, bs_idx + 1, 1) + p = substr(p, bs_idx + 2) + + if ((esc_idx = index("abtvfr\"\\", esc)) != 0) { + # C-style one-character escape sequence. + out = out substr("\a\b\t\v\f\r\"\\", + esc_idx, 1) + } else if (esc == "n") { + # Uh-oh, a newline character. + # We cannot reliably put a pathname + # containing a newline into COMPREPLY, + # and the newline would create a mess. + # Skip this path. + return "" + } else { + # Must be a \nnn octal value, then. + dec = esc * 64 + \ + substr(p, 1, 1) * 8 + \ + substr(p, 2, 1) + out = out sprintf("%c", dec) + p = substr(p, 3) + } + } + # Drop closing double quote, if there is one. + # (There is not any if this is a directory, as it was + # already stripped with the trailing path components.) + if (substr(p, length(p), 1) == "\"") + out = out substr(p, 1, length(p) - 1) + else + out = out p + + return out + }' +} + +# __git_complete_index_file requires 1 argument: +# 1: the options to pass to ls-file +# +# The exception is --committable, which finds the files appropriate commit. +__git_complete_index_file () +{ + local dequoted_word pfx="" cur_ + + __git_dequote "$cur" + + case "$dequoted_word" in + ?*/*) + pfx="${dequoted_word%/*}/" + cur_="${dequoted_word##*/}" + ;; + *) + cur_="$dequoted_word" + esac + + __gitcomp_file_direct "$(__git_index_files "$1" "$pfx" "$cur_")" +} + +# Lists branches from the local repository. +# 1: A prefix to be added to each listed branch (optional). +# 2: List only branches matching this word (optional; list all branches if +# unset or empty). +# 3: A suffix to be appended to each listed branch (optional). +__git_heads () +{ + local pfx="${1-}" cur_="${2-}" sfx="${3-}" + + __git for-each-ref --format="${pfx//\%/%%}%(refname:strip=2)$sfx" \ + "refs/heads/$cur_*" "refs/heads/$cur_*/**" +} + +# Lists branches from remote repositories. +# 1: A prefix to be added to each listed branch (optional). +# 2: List only branches matching this word (optional; list all branches if +# unset or empty). +# 3: A suffix to be appended to each listed branch (optional). +__git_remote_heads () +{ + local pfx="${1-}" cur_="${2-}" sfx="${3-}" + + __git for-each-ref --format="${pfx//\%/%%}%(refname:strip=2)$sfx" \ + "refs/remotes/$cur_*" "refs/remotes/$cur_*/**" +} + +# Lists tags from the local repository. +# Accepts the same positional parameters as __git_heads() above. +__git_tags () +{ + local pfx="${1-}" cur_="${2-}" sfx="${3-}" + + __git for-each-ref --format="${pfx//\%/%%}%(refname:strip=2)$sfx" \ + "refs/tags/$cur_*" "refs/tags/$cur_*/**" +} + +# List unique branches from refs/remotes used for 'git checkout' and 'git +# switch' tracking DWIMery. +# 1: A prefix to be added to each listed branch (optional) +# 2: List only branches matching this word (optional; list all branches if +# unset or empty). +# 3: A suffix to be appended to each listed branch (optional). +__git_dwim_remote_heads () +{ + local pfx="${1-}" cur_="${2-}" sfx="${3-}" + local fer_pfx="${pfx//\%/%%}" # "escape" for-each-ref format specifiers + + # employ the heuristic used by git checkout and git switch + # Try to find a remote branch that cur_es the completion word + # but only output if the branch name is unique + __git for-each-ref --format="$fer_pfx%(refname:strip=3)$sfx" \ + --sort="refname:strip=3" \ + "refs/remotes/*/$cur_*" "refs/remotes/*/$cur_*/**" | \ + uniq -u +} + +# Lists refs from the local (by default) or from a remote repository. +# It accepts 0, 1 or 2 arguments: +# 1: The remote to list refs from (optional; ignored, if set but empty). +# Can be the name of a configured remote, a path, or a URL. +# 2: In addition to local refs, list unique branches from refs/remotes/ for +# 'git checkout's tracking DWIMery (optional; ignored, if set but empty). +# 3: A prefix to be added to each listed ref (optional). +# 4: List only refs matching this word (optional; list all refs if unset or +# empty). +# 5: A suffix to be appended to each listed ref (optional; ignored, if set +# but empty). +# +# Use __git_complete_refs() instead. +__git_refs () +{ + local i hash dir track="${2-}" + local list_refs_from=path remote="${1-}" + local format refs + local pfx="${3-}" cur_="${4-$cur}" sfx="${5-}" + local match="${4-}" + local fer_pfx="${pfx//\%/%%}" # "escape" for-each-ref format specifiers + + __git_find_repo_path + dir="$__git_repo_path" + + if [ -z "$remote" ]; then + if [ -z "$dir" ]; then + return + fi + else + if __git_is_configured_remote "$remote"; then + # configured remote takes precedence over a + # local directory with the same name + list_refs_from=remote + elif [ -d "$remote/.git" ]; then + dir="$remote/.git" + elif [ -d "$remote" ]; then + dir="$remote" + else + list_refs_from=url + fi + fi + + if [ "$list_refs_from" = path ]; then + if [[ "$cur_" == ^* ]]; then + pfx="$pfx^" + fer_pfx="$fer_pfx^" + cur_=${cur_#^} + match=${match#^} + fi + case "$cur_" in + refs|refs/*) + format="refname" + refs=("$match*" "$match*/**") + track="" + ;; + *) + for i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD REBASE_HEAD; do + case "$i" in + $match*) + if [ -e "$dir/$i" ]; then + echo "$pfx$i$sfx" + fi + ;; + esac + done + format="refname:strip=2" + refs=("refs/tags/$match*" "refs/tags/$match*/**" + "refs/heads/$match*" "refs/heads/$match*/**" + "refs/remotes/$match*" "refs/remotes/$match*/**") + ;; + esac + __git_dir="$dir" __git for-each-ref --format="$fer_pfx%($format)$sfx" \ + "${refs[@]}" + if [ -n "$track" ]; then + __git_dwim_remote_heads "$pfx" "$match" "$sfx" + fi + return + fi + case "$cur_" in + refs|refs/*) + __git ls-remote "$remote" "$match*" | \ + while read -r hash i; do + case "$i" in + *^{}) ;; + *) echo "$pfx$i$sfx" ;; + esac + done + ;; + *) + if [ "$list_refs_from" = remote ]; then + case "HEAD" in + $match*) echo "${pfx}HEAD$sfx" ;; + esac + __git for-each-ref --format="$fer_pfx%(refname:strip=3)$sfx" \ + "refs/remotes/$remote/$match*" \ + "refs/remotes/$remote/$match*/**" + else + local query_symref + case "HEAD" in + $match*) query_symref="HEAD" ;; + esac + __git ls-remote "$remote" $query_symref \ + "refs/tags/$match*" "refs/heads/$match*" \ + "refs/remotes/$match*" | + while read -r hash i; do + case "$i" in + *^{}) ;; + refs/*) echo "$pfx${i#refs/*/}$sfx" ;; + *) echo "$pfx$i$sfx" ;; # symbolic refs + esac + done + fi + ;; + esac +} + +# Completes refs, short and long, local and remote, symbolic and pseudo. +# +# Usage: __git_complete_refs [<option>]... +# --remote=<remote>: The remote to list refs from, can be the name of a +# configured remote, a path, or a URL. +# --dwim: List unique remote branches for 'git switch's tracking DWIMery. +# --pfx=<prefix>: A prefix to be added to each ref. +# --cur=<word>: The current ref to be completed. Defaults to the current +# word to be completed. +# --sfx=<suffix>: A suffix to be appended to each ref instead of the default +# space. +# --mode=<mode>: What set of refs to complete, one of 'refs' (the default) to +# complete all refs, 'heads' to complete only branches, or +# 'remote-heads' to complete only remote branches. Note that +# --remote is only compatible with --mode=refs. +__git_complete_refs () +{ + local remote= dwim= pfx= cur_="$cur" sfx=" " mode="refs" + + while test $# != 0; do + case "$1" in + --remote=*) remote="${1##--remote=}" ;; + --dwim) dwim="yes" ;; + # --track is an old spelling of --dwim + --track) dwim="yes" ;; + --pfx=*) pfx="${1##--pfx=}" ;; + --cur=*) cur_="${1##--cur=}" ;; + --sfx=*) sfx="${1##--sfx=}" ;; + --mode=*) mode="${1##--mode=}" ;; + *) return 1 ;; + esac + shift + done + + # complete references based on the specified mode + case "$mode" in + refs) + __gitcomp_direct "$(__git_refs "$remote" "" "$pfx" "$cur_" "$sfx")" ;; + heads) + __gitcomp_direct "$(__git_heads "$pfx" "$cur_" "$sfx")" ;; + remote-heads) + __gitcomp_direct "$(__git_remote_heads "$pfx" "$cur_" "$sfx")" ;; + *) + return 1 ;; + esac + + # Append DWIM remote branch names if requested + if [ "$dwim" = "yes" ]; then + __gitcomp_direct_append "$(__git_dwim_remote_heads "$pfx" "$cur_" "$sfx")" + fi +} + +# __git_refs2 requires 1 argument (to pass to __git_refs) +# Deprecated: use __git_complete_fetch_refspecs() instead. +__git_refs2 () +{ + local i + for i in $(__git_refs "$1"); do + echo "$i:$i" + done +} + +# Completes refspecs for fetching from a remote repository. +# 1: The remote repository. +# 2: A prefix to be added to each listed refspec (optional). +# 3: The ref to be completed as a refspec instead of the current word to be +# completed (optional) +# 4: A suffix to be appended to each listed refspec instead of the default +# space (optional). +__git_complete_fetch_refspecs () +{ + local i remote="$1" pfx="${2-}" cur_="${3-$cur}" sfx="${4- }" + + __gitcomp_direct "$( + for i in $(__git_refs "$remote" "" "" "$cur_") ; do + echo "$pfx$i:$i$sfx" + done + )" +} + +# __git_refs_remotes requires 1 argument (to pass to ls-remote) +__git_refs_remotes () +{ + local i hash + __git ls-remote "$1" 'refs/heads/*' | \ + while read -r hash i; do + echo "$i:refs/remotes/$1/${i#refs/heads/}" + done +} + +__git_remotes () +{ + __git_find_repo_path + test -d "$__git_repo_path/remotes" && ls -1 "$__git_repo_path/remotes" + __git remote +} + +# Returns true if $1 matches the name of a configured remote, false otherwise. +__git_is_configured_remote () +{ + local remote + for remote in $(__git_remotes); do + if [ "$remote" = "$1" ]; then + return 0 + fi + done + return 1 +} + +__git_list_merge_strategies () +{ + LANG=C LC_ALL=C git merge -s help 2>&1 | + sed -n -e '/[Aa]vailable strategies are: /,/^$/{ + s/\.$// + s/.*:// + s/^[ ]*// + s/[ ]*$// + p + }' +} + +__git_merge_strategies= +# 'git merge -s help' (and thus detection of the merge strategy +# list) fails, unfortunately, if run outside of any git working +# tree. __git_merge_strategies is set to the empty string in +# that case, and the detection will be repeated the next time it +# is needed. +__git_compute_merge_strategies () +{ + test -n "$__git_merge_strategies" || + __git_merge_strategies=$(__git_list_merge_strategies) +} + +__git_merge_strategy_options="ours theirs subtree subtree= patience + histogram diff-algorithm= ignore-space-change ignore-all-space + ignore-space-at-eol renormalize no-renormalize no-renames + find-renames find-renames= rename-threshold=" + +__git_complete_revlist_file () +{ + local dequoted_word pfx ls ref cur_="$cur" + case "$cur_" in + *..?*:*) + return + ;; + ?*:*) + ref="${cur_%%:*}" + cur_="${cur_#*:}" + + __git_dequote "$cur_" + + case "$dequoted_word" in + ?*/*) + pfx="${dequoted_word%/*}" + cur_="${dequoted_word##*/}" + ls="$ref:$pfx" + pfx="$pfx/" + ;; + *) + cur_="$dequoted_word" + ls="$ref" + ;; + esac + + case "$COMP_WORDBREAKS" in + *:*) : great ;; + *) pfx="$ref:$pfx" ;; + esac + + __gitcomp_file "$(__git ls-tree "$ls" \ + | sed 's/^.* // + s/$//')" \ + "$pfx" "$cur_" + ;; + *...*) + pfx="${cur_%...*}..." + cur_="${cur_#*...}" + __git_complete_refs --pfx="$pfx" --cur="$cur_" + ;; + *..*) + pfx="${cur_%..*}.." + cur_="${cur_#*..}" + __git_complete_refs --pfx="$pfx" --cur="$cur_" + ;; + *) + __git_complete_refs + ;; + esac +} + +__git_complete_file () +{ + __git_complete_revlist_file +} + +__git_complete_revlist () +{ + __git_complete_revlist_file +} + +__git_complete_remote_or_refspec () +{ + local cur_="$cur" cmd="${words[1]}" + local i c=2 remote="" pfx="" lhs=1 no_complete_refspec=0 + if [ "$cmd" = "remote" ]; then + ((c++)) + fi + while [ $c -lt $cword ]; do + i="${words[c]}" + case "$i" in + --mirror) [ "$cmd" = "push" ] && no_complete_refspec=1 ;; + -d|--delete) [ "$cmd" = "push" ] && lhs=0 ;; + --all) + case "$cmd" in + push) no_complete_refspec=1 ;; + fetch) + return + ;; + *) ;; + esac + ;; + --multiple) no_complete_refspec=1; break ;; + -*) ;; + *) remote="$i"; break ;; + esac + ((c++)) + done + if [ -z "$remote" ]; then + __gitcomp_nl "$(__git_remotes)" + return + fi + if [ $no_complete_refspec = 1 ]; then + return + fi + [ "$remote" = "." ] && remote= + case "$cur_" in + *:*) + case "$COMP_WORDBREAKS" in + *:*) : great ;; + *) pfx="${cur_%%:*}:" ;; + esac + cur_="${cur_#*:}" + lhs=0 + ;; + +*) + pfx="+" + cur_="${cur_#+}" + ;; + esac + case "$cmd" in + fetch) + if [ $lhs = 1 ]; then + __git_complete_fetch_refspecs "$remote" "$pfx" "$cur_" + else + __git_complete_refs --pfx="$pfx" --cur="$cur_" + fi + ;; + pull|remote) + if [ $lhs = 1 ]; then + __git_complete_refs --remote="$remote" --pfx="$pfx" --cur="$cur_" + else + __git_complete_refs --pfx="$pfx" --cur="$cur_" + fi + ;; + push) + if [ $lhs = 1 ]; then + __git_complete_refs --pfx="$pfx" --cur="$cur_" + else + __git_complete_refs --remote="$remote" --pfx="$pfx" --cur="$cur_" + fi + ;; + esac +} + +__git_complete_strategy () +{ + __git_compute_merge_strategies + case "$prev" in + -s|--strategy) + __gitcomp "$__git_merge_strategies" + return 0 + ;; + -X) + __gitcomp "$__git_merge_strategy_options" + return 0 + ;; + esac + case "$cur" in + --strategy=*) + __gitcomp "$__git_merge_strategies" "" "${cur##--strategy=}" + return 0 + ;; + --strategy-option=*) + __gitcomp "$__git_merge_strategy_options" "" "${cur##--strategy-option=}" + return 0 + ;; + esac + return 1 +} + +__git_all_commands= +__git_compute_all_commands () +{ + test -n "$__git_all_commands" || + __git_all_commands=$(__git --list-cmds=main,others,alias,nohelpers) +} + +# Lists all set config variables starting with the given section prefix, +# with the prefix removed. +__git_get_config_variables () +{ + local section="$1" i IFS=$'\n' + for i in $(__git config --name-only --get-regexp "^$section\..*"); do + echo "${i#$section.}" + done +} + +__git_pretty_aliases () +{ + __git_get_config_variables "pretty" +} + +# __git_aliased_command requires 1 argument +__git_aliased_command () +{ + local cur=$1 last list word cmdline + + while [[ -n "$cur" ]]; do + if [[ "$list" == *" $cur "* ]]; then + # loop detected + return + fi + + cmdline=$(__git config --get "alias.$cur") + list=" $cur $list" + last=$cur + cur= + + for word in $cmdline; do + case "$word" in + \!gitk|gitk) + cur="gitk" + break + ;; + \!*) : shell command alias ;; + -*) : option ;; + *=*) : setting env ;; + git) : git itself ;; + \(\)) : skip parens of shell function definition ;; + {) : skip start of shell helper function ;; + :) : skip null command ;; + \'*) : skip opening quote after sh -c ;; + *) + cur="$word" + break + esac + done + done + + cur=$last + if [[ "$cur" != "$1" ]]; then + echo "$cur" + fi +} + +# Check whether one of the given words is present on the command line, +# and print the first word found. +# +# Usage: __git_find_on_cmdline [<option>]... "<wordlist>" +# --show-idx: Optionally show the index of the found word in the $words array. +__git_find_on_cmdline () +{ + local word c=1 show_idx + + while test $# -gt 1; do + case "$1" in + --show-idx) show_idx=y ;; + *) return 1 ;; + esac + shift + done + local wordlist="$1" + + while [ $c -lt $cword ]; do + for word in $wordlist; do + if [ "$word" = "${words[c]}" ]; then + if [ -n "${show_idx-}" ]; then + echo "$c $word" + else + echo "$word" + fi + return + fi + done + ((c++)) + done +} + +# Similar to __git_find_on_cmdline, except that it loops backwards and thus +# prints the *last* word found. Useful for finding which of two options that +# supersede each other came last, such as "--guess" and "--no-guess". +# +# Usage: __git_find_last_on_cmdline [<option>]... "<wordlist>" +# --show-idx: Optionally show the index of the found word in the $words array. +__git_find_last_on_cmdline () +{ + local word c=$cword show_idx + + while test $# -gt 1; do + case "$1" in + --show-idx) show_idx=y ;; + *) return 1 ;; + esac + shift + done + local wordlist="$1" + + while [ $c -gt 1 ]; do + ((c--)) + for word in $wordlist; do + if [ "$word" = "${words[c]}" ]; then + if [ -n "$show_idx" ]; then + echo "$c $word" + else + echo "$word" + fi + return + fi + done + done +} + +# Echo the value of an option set on the command line or config +# +# $1: short option name +# $2: long option name including = +# $3: list of possible values +# $4: config string (optional) +# +# example: +# result="$(__git_get_option_value "-d" "--do-something=" \ +# "yes no" "core.doSomething")" +# +# result is then either empty (no option set) or "yes" or "no" +# +# __git_get_option_value requires 3 arguments +__git_get_option_value () +{ + local c short_opt long_opt val + local result= values config_key word + + short_opt="$1" + long_opt="$2" + values="$3" + config_key="$4" + + ((c = $cword - 1)) + while [ $c -ge 0 ]; do + word="${words[c]}" + for val in $values; do + if [ "$short_opt$val" = "$word" ] || + [ "$long_opt$val" = "$word" ]; then + result="$val" + break 2 + fi + done + ((c--)) + done + + if [ -n "$config_key" ] && [ -z "$result" ]; then + result="$(__git config "$config_key")" + fi + + echo "$result" +} + +__git_has_doubledash () +{ + local c=1 + while [ $c -lt $cword ]; do + if [ "--" = "${words[c]}" ]; then + return 0 + fi + ((c++)) + done + return 1 +} + +# Try to count non option arguments passed on the command line for the +# specified git command. +# When options are used, it is necessary to use the special -- option to +# tell the implementation were non option arguments begin. +# XXX this can not be improved, since options can appear everywhere, as +# an example: +# git mv x -n y +# +# __git_count_arguments requires 1 argument: the git command executed. +__git_count_arguments () +{ + local word i c=0 + + # Skip "git" (first argument) + for ((i=1; i < ${#words[@]}; i++)); do + word="${words[i]}" + + case "$word" in + --) + # Good; we can assume that the following are only non + # option arguments. + ((c = 0)) + ;; + "$1") + # Skip the specified git command and discard git + # main options + ((c = 0)) + ;; + ?*) + ((c++)) + ;; + esac + done + + printf "%d" $c +} + +__git_whitespacelist="nowarn warn error error-all fix" +__git_patchformat="mbox stgit stgit-series hg mboxrd" +__git_showcurrentpatch="diff raw" +__git_am_inprogress_options="--skip --continue --resolved --abort --quit --show-current-patch" + +_git_am () +{ + __git_find_repo_path + if [ -d "$__git_repo_path"/rebase-apply ]; then + __gitcomp "$__git_am_inprogress_options" + return + fi + case "$cur" in + --whitespace=*) + __gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}" + return + ;; + --patch-format=*) + __gitcomp "$__git_patchformat" "" "${cur##--patch-format=}" + return + ;; + --show-current-patch=*) + __gitcomp "$__git_showcurrentpatch" "" "${cur##--show-current-patch=}" + return + ;; + --*) + __gitcomp_builtin am "" \ + "$__git_am_inprogress_options" + return + esac +} + +_git_apply () +{ + case "$cur" in + --whitespace=*) + __gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}" + return + ;; + --*) + __gitcomp_builtin apply + return + esac +} + +_git_add () +{ + case "$cur" in + --chmod=*) + __gitcomp "+x -x" "" "${cur##--chmod=}" + return + ;; + --*) + __gitcomp_builtin add + return + esac + + local complete_opt="--others --modified --directory --no-empty-directory" + if test -n "$(__git_find_on_cmdline "-u --update")" + then + complete_opt="--modified" + fi + __git_complete_index_file "$complete_opt" +} + +_git_archive () +{ + case "$cur" in + --format=*) + __gitcomp "$(git archive --list)" "" "${cur##--format=}" + return + ;; + --remote=*) + __gitcomp_nl "$(__git_remotes)" "" "${cur##--remote=}" + return + ;; + --*) + __gitcomp_builtin archive "--format= --list --verbose --prefix= --worktree-attributes" + return + ;; + esac + __git_complete_file +} + +_git_bisect () +{ + __git_has_doubledash && return + + local subcommands="start bad good skip reset visualize replay log run" + local subcommand="$(__git_find_on_cmdline "$subcommands")" + if [ -z "$subcommand" ]; then + __git_find_repo_path + if [ -f "$__git_repo_path"/BISECT_START ]; then + __gitcomp "$subcommands" + else + __gitcomp "replay start" + fi + return + fi + + case "$subcommand" in + bad|good|reset|skip|start) + __git_complete_refs + ;; + *) + ;; + esac +} + +__git_ref_fieldlist="refname objecttype objectsize objectname upstream push HEAD symref" + +_git_branch () +{ + local i c=1 only_local_ref="n" has_r="n" + + while [ $c -lt $cword ]; do + i="${words[c]}" + case "$i" in + -d|--delete|-m|--move) only_local_ref="y" ;; + -r|--remotes) has_r="y" ;; + esac + ((c++)) + done + + case "$cur" in + --set-upstream-to=*) + __git_complete_refs --cur="${cur##--set-upstream-to=}" + ;; + --*) + __gitcomp_builtin branch + ;; + *) + if [ $only_local_ref = "y" -a $has_r = "n" ]; then + __gitcomp_direct "$(__git_heads "" "$cur" " ")" + else + __git_complete_refs + fi + ;; + esac +} + +_git_bundle () +{ + local cmd="${words[2]}" + case "$cword" in + 2) + __gitcomp "create list-heads verify unbundle" + ;; + 3) + # looking for a file + ;; + *) + case "$cmd" in + create) + __git_complete_revlist + ;; + esac + ;; + esac +} + +# Helper function to decide whether or not we should enable DWIM logic for +# git-switch and git-checkout. +# +# To decide between the following rules in decreasing priority order: +# - the last provided of "--guess" or "--no-guess" explicitly enable or +# disable completion of DWIM logic respectively. +# - If checkout.guess is false, disable completion of DWIM logic. +# - If the --no-track option is provided, take this as a hint to disable the +# DWIM completion logic +# - If GIT_COMPLETION_CHECKOUT_NO_GUESS is set, disable the DWIM completion +# logic, as requested by the user. +# - Enable DWIM logic otherwise. +# +__git_checkout_default_dwim_mode () +{ + local last_option dwim_opt="--dwim" + + if [ "${GIT_COMPLETION_CHECKOUT_NO_GUESS-}" = "1" ]; then + dwim_opt="" + fi + + # --no-track disables DWIM, but with lower priority than + # --guess/--no-guess/checkout.guess + if [ -n "$(__git_find_on_cmdline "--no-track")" ]; then + dwim_opt="" + fi + + # checkout.guess = false disables DWIM, but with lower priority than + # --guess/--no-guess + if [ "$(__git config --type=bool checkout.guess)" = "false" ]; then + dwim_opt="" + fi + + # Find the last provided --guess or --no-guess + last_option="$(__git_find_last_on_cmdline "--guess --no-guess")" + case "$last_option" in + --guess) + dwim_opt="--dwim" + ;; + --no-guess) + dwim_opt="" + ;; + esac + + echo "$dwim_opt" +} + +_git_checkout () +{ + __git_has_doubledash && return + + local dwim_opt="$(__git_checkout_default_dwim_mode)" + + case "$prev" in + -b|-B|--orphan) + # Complete local branches (and DWIM branch + # remote branch names) for an option argument + # specifying a new branch name. This is for + # convenience, assuming new branches are + # possibly based on pre-existing branch names. + __git_complete_refs $dwim_opt --mode="heads" + return + ;; + *) + ;; + esac + + case "$cur" in + --conflict=*) + __gitcomp "diff3 merge" "" "${cur##--conflict=}" + ;; + --*) + __gitcomp_builtin checkout + ;; + *) + # At this point, we've already handled special completion for + # the arguments to -b/-B, and --orphan. There are 3 main + # things left we can possibly complete: + # 1) a start-point for -b/-B, -d/--detach, or --orphan + # 2) a remote head, for --track + # 3) an arbitrary reference, possibly including DWIM names + # + + if [ -n "$(__git_find_on_cmdline "-b -B -d --detach --orphan")" ]; then + __git_complete_refs --mode="refs" + elif [ -n "$(__git_find_on_cmdline "--track")" ]; then + __git_complete_refs --mode="remote-heads" + else + __git_complete_refs $dwim_opt --mode="refs" + fi + ;; + esac +} + +__git_sequencer_inprogress_options="--continue --quit --abort --skip" + +__git_cherry_pick_inprogress_options=$__git_sequencer_inprogress_options + +_git_cherry_pick () +{ + __git_find_repo_path + if [ -f "$__git_repo_path"/CHERRY_PICK_HEAD ]; then + __gitcomp "$__git_cherry_pick_inprogress_options" + return + fi + + __git_complete_strategy && return + + case "$cur" in + --*) + __gitcomp_builtin cherry-pick "" \ + "$__git_cherry_pick_inprogress_options" + ;; + *) + __git_complete_refs + ;; + esac +} + +_git_clean () +{ + case "$cur" in + --*) + __gitcomp_builtin clean + return + ;; + esac + + # XXX should we check for -x option ? + __git_complete_index_file "--others --directory" +} + +_git_clone () +{ + case "$prev" in + -c|--config) + __git_complete_config_variable_name_and_value + return + ;; + esac + case "$cur" in + --config=*) + __git_complete_config_variable_name_and_value \ + --cur="${cur##--config=}" + return + ;; + --*) + __gitcomp_builtin clone + return + ;; + esac +} + +__git_untracked_file_modes="all no normal" + +_git_commit () +{ + case "$prev" in + -c|-C) + __git_complete_refs + return + ;; + esac + + case "$cur" in + --cleanup=*) + __gitcomp "default scissors strip verbatim whitespace + " "" "${cur##--cleanup=}" + return + ;; + --reuse-message=*|--reedit-message=*|\ + --fixup=*|--squash=*) + __git_complete_refs --cur="${cur#*=}" + return + ;; + --untracked-files=*) + __gitcomp "$__git_untracked_file_modes" "" "${cur##--untracked-files=}" + return + ;; + --*) + __gitcomp_builtin commit + return + esac + + if __git rev-parse --verify --quiet HEAD >/dev/null; then + __git_complete_index_file "--committable" + else + # This is the first commit + __git_complete_index_file "--cached" + fi +} + +_git_describe () +{ + case "$cur" in + --*) + __gitcomp_builtin describe + return + esac + __git_complete_refs +} + +__git_diff_algorithms="myers minimal patience histogram" + +__git_diff_submodule_formats="diff log short" + +__git_color_moved_opts="no default plain blocks zebra dimmed-zebra" + +__git_color_moved_ws_opts="no ignore-space-at-eol ignore-space-change + ignore-all-space allow-indentation-change" + +__git_diff_common_options="--stat --numstat --shortstat --summary + --patch-with-stat --name-only --name-status --color + --no-color --color-words --no-renames --check + --color-moved --color-moved= --no-color-moved + --color-moved-ws= --no-color-moved-ws + --full-index --binary --abbrev --diff-filter= + --find-copies-harder --ignore-cr-at-eol + --text --ignore-space-at-eol --ignore-space-change + --ignore-all-space --ignore-blank-lines --exit-code + --quiet --ext-diff --no-ext-diff + --no-prefix --src-prefix= --dst-prefix= + --inter-hunk-context= + --patience --histogram --minimal + --raw --word-diff --word-diff-regex= + --dirstat --dirstat= --dirstat-by-file + --dirstat-by-file= --cumulative + --diff-algorithm= + --submodule --submodule= --ignore-submodules + --indent-heuristic --no-indent-heuristic + --textconv --no-textconv + --patch --no-patch +" + +__git_diff_difftool_options="--cached --staged --pickaxe-all --pickaxe-regex + --base --ours --theirs --no-index --relative --merge-base + $__git_diff_common_options" + +_git_diff () +{ + __git_has_doubledash && return + + case "$cur" in + --diff-algorithm=*) + __gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}" + return + ;; + --submodule=*) + __gitcomp "$__git_diff_submodule_formats" "" "${cur##--submodule=}" + return + ;; + --color-moved=*) + __gitcomp "$__git_color_moved_opts" "" "${cur##--color-moved=}" + return + ;; + --color-moved-ws=*) + __gitcomp "$__git_color_moved_ws_opts" "" "${cur##--color-moved-ws=}" + return + ;; + --*) + __gitcomp "$__git_diff_difftool_options" + return + ;; + esac + __git_complete_revlist_file +} + +__git_mergetools_common="diffuse diffmerge ecmerge emerge kdiff3 meld opendiff + tkdiff vimdiff nvimdiff gvimdiff xxdiff araxis p4merge + bc codecompare smerge +" + +_git_difftool () +{ + __git_has_doubledash && return + + case "$cur" in + --tool=*) + __gitcomp "$__git_mergetools_common kompare" "" "${cur##--tool=}" + return + ;; + --*) + __gitcomp_builtin difftool "$__git_diff_difftool_options" + return + ;; + esac + __git_complete_revlist_file +} + +__git_fetch_recurse_submodules="yes on-demand no" + +_git_fetch () +{ + case "$cur" in + --recurse-submodules=*) + __gitcomp "$__git_fetch_recurse_submodules" "" "${cur##--recurse-submodules=}" + return + ;; + --filter=*) + __gitcomp "blob:none blob:limit= sparse:oid=" "" "${cur##--filter=}" + return + ;; + --*) + __gitcomp_builtin fetch + return + ;; + esac + __git_complete_remote_or_refspec +} + +__git_format_patch_extra_options=" + --full-index --not --all --no-prefix --src-prefix= + --dst-prefix= --notes +" + +_git_format_patch () +{ + case "$cur" in + --thread=*) + __gitcomp " + deep shallow + " "" "${cur##--thread=}" + return + ;; + --base=*|--interdiff=*|--range-diff=*) + __git_complete_refs --cur="${cur#--*=}" + return + ;; + --*) + __gitcomp_builtin format-patch "$__git_format_patch_extra_options" + return + ;; + esac + __git_complete_revlist +} + +_git_fsck () +{ + case "$cur" in + --*) + __gitcomp_builtin fsck + return + ;; + esac +} + +_git_gitk () +{ + __gitk_main +} + +# Lists matching symbol names from a tag (as in ctags) file. +# 1: List symbol names matching this word. +# 2: The tag file to list symbol names from. +# 3: A prefix to be added to each listed symbol name (optional). +# 4: A suffix to be appended to each listed symbol name (optional). +__git_match_ctag () { + awk -v pfx="${3-}" -v sfx="${4-}" " + /^${1//\//\\/}/ { print pfx \$1 sfx } + " "$2" +} + +# Complete symbol names from a tag file. +# Usage: __git_complete_symbol [<option>]... +# --tags=<file>: The tag file to list symbol names from instead of the +# default "tags". +# --pfx=<prefix>: A prefix to be added to each symbol name. +# --cur=<word>: The current symbol name to be completed. Defaults to +# the current word to be completed. +# --sfx=<suffix>: A suffix to be appended to each symbol name instead +# of the default space. +__git_complete_symbol () { + local tags=tags pfx="" cur_="${cur-}" sfx=" " + + while test $# != 0; do + case "$1" in + --tags=*) tags="${1##--tags=}" ;; + --pfx=*) pfx="${1##--pfx=}" ;; + --cur=*) cur_="${1##--cur=}" ;; + --sfx=*) sfx="${1##--sfx=}" ;; + *) return 1 ;; + esac + shift + done + + if test -r "$tags"; then + __gitcomp_direct "$(__git_match_ctag "$cur_" "$tags" "$pfx" "$sfx")" + fi +} + +_git_grep () +{ + __git_has_doubledash && return + + case "$cur" in + --*) + __gitcomp_builtin grep + return + ;; + esac + + case "$cword,$prev" in + 2,*|*,-*) + __git_complete_symbol && return + ;; + esac + + __git_complete_refs +} + +_git_help () +{ + case "$cur" in + --*) + __gitcomp_builtin help + return + ;; + esac + if test -n "$GIT_TESTING_ALL_COMMAND_LIST" + then + __gitcomp "$GIT_TESTING_ALL_COMMAND_LIST $(__git --list-cmds=alias,list-guide) gitk" + else + __gitcomp "$(__git --list-cmds=main,nohelpers,alias,list-guide) gitk" + fi +} + +_git_init () +{ + case "$cur" in + --shared=*) + __gitcomp " + false true umask group all world everybody + " "" "${cur##--shared=}" + return + ;; + --*) + __gitcomp_builtin init + return + ;; + esac +} + +_git_ls_files () +{ + case "$cur" in + --*) + __gitcomp_builtin ls-files + return + ;; + esac + + # XXX ignore options like --modified and always suggest all cached + # files. + __git_complete_index_file "--cached" +} + +_git_ls_remote () +{ + case "$cur" in + --*) + __gitcomp_builtin ls-remote + return + ;; + esac + __gitcomp_nl "$(__git_remotes)" +} + +_git_ls_tree () +{ + case "$cur" in + --*) + __gitcomp_builtin ls-tree + return + ;; + esac + + __git_complete_file +} + +# Options that go well for log, shortlog and gitk +__git_log_common_options=" + --not --all + --branches --tags --remotes + --first-parent --merges --no-merges + --max-count= + --max-age= --since= --after= + --min-age= --until= --before= + --min-parents= --max-parents= + --no-min-parents --no-max-parents +" +# Options that go well for log and gitk (not shortlog) +__git_log_gitk_options=" + --dense --sparse --full-history + --simplify-merges --simplify-by-decoration + --left-right --notes --no-notes +" +# Options that go well for log and shortlog (not gitk) +__git_log_shortlog_options=" + --author= --committer= --grep= + --all-match --invert-grep +" + +__git_log_pretty_formats="oneline short medium full fuller reference email raw format: tformat: mboxrd" +__git_log_date_formats="relative iso8601 iso8601-strict rfc2822 short local default raw unix format:" + +_git_log () +{ + __git_has_doubledash && return + __git_find_repo_path + + local merge="" + if [ -f "$__git_repo_path/MERGE_HEAD" ]; then + merge="--merge" + fi + case "$prev,$cur" in + -L,:*:*) + return # fall back to Bash filename completion + ;; + -L,:*) + __git_complete_symbol --cur="${cur#:}" --sfx=":" + return + ;; + -G,*|-S,*) + __git_complete_symbol + return + ;; + esac + case "$cur" in + --pretty=*|--format=*) + __gitcomp "$__git_log_pretty_formats $(__git_pretty_aliases) + " "" "${cur#*=}" + return + ;; + --date=*) + __gitcomp "$__git_log_date_formats" "" "${cur##--date=}" + return + ;; + --decorate=*) + __gitcomp "full short no" "" "${cur##--decorate=}" + return + ;; + --diff-algorithm=*) + __gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}" + return + ;; + --submodule=*) + __gitcomp "$__git_diff_submodule_formats" "" "${cur##--submodule=}" + return + ;; + --no-walk=*) + __gitcomp "sorted unsorted" "" "${cur##--no-walk=}" + return + ;; + --*) + __gitcomp " + $__git_log_common_options + $__git_log_shortlog_options + $__git_log_gitk_options + --root --topo-order --date-order --reverse + --follow --full-diff + --abbrev-commit --no-abbrev-commit --abbrev= + --relative-date --date= + --pretty= --format= --oneline + --show-signature + --cherry-mark + --cherry-pick + --graph + --decorate --decorate= --no-decorate + --walk-reflogs + --no-walk --no-walk= --do-walk + --parents --children + --expand-tabs --expand-tabs= --no-expand-tabs + $merge + $__git_diff_common_options + --pickaxe-all --pickaxe-regex + " + return + ;; + -L:*:*) + return # fall back to Bash filename completion + ;; + -L:*) + __git_complete_symbol --cur="${cur#-L:}" --sfx=":" + return + ;; + -G*) + __git_complete_symbol --pfx="-G" --cur="${cur#-G}" + return + ;; + -S*) + __git_complete_symbol --pfx="-S" --cur="${cur#-S}" + return + ;; + esac + __git_complete_revlist +} + +_git_merge () +{ + __git_complete_strategy && return + + case "$cur" in + --*) + __gitcomp_builtin merge + return + esac + __git_complete_refs +} + +_git_mergetool () +{ + case "$cur" in + --tool=*) + __gitcomp "$__git_mergetools_common tortoisemerge" "" "${cur##--tool=}" + return + ;; + --*) + __gitcomp "--tool= --prompt --no-prompt --gui --no-gui" + return + ;; + esac +} + +_git_merge_base () +{ + case "$cur" in + --*) + __gitcomp_builtin merge-base + return + ;; + esac + __git_complete_refs +} + +_git_mv () +{ + case "$cur" in + --*) + __gitcomp_builtin mv + return + ;; + esac + + if [ $(__git_count_arguments "mv") -gt 0 ]; then + # We need to show both cached and untracked files (including + # empty directories) since this may not be the last argument. + __git_complete_index_file "--cached --others --directory" + else + __git_complete_index_file "--cached" + fi +} + +_git_notes () +{ + local subcommands='add append copy edit get-ref list merge prune remove show' + local subcommand="$(__git_find_on_cmdline "$subcommands")" + + case "$subcommand,$cur" in + ,--*) + __gitcomp_builtin notes + ;; + ,*) + case "$prev" in + --ref) + __git_complete_refs + ;; + *) + __gitcomp "$subcommands --ref" + ;; + esac + ;; + *,--reuse-message=*|*,--reedit-message=*) + __git_complete_refs --cur="${cur#*=}" + ;; + *,--*) + __gitcomp_builtin notes_$subcommand + ;; + prune,*|get-ref,*) + # this command does not take a ref, do not complete it + ;; + *) + case "$prev" in + -m|-F) + ;; + *) + __git_complete_refs + ;; + esac + ;; + esac +} + +_git_pull () +{ + __git_complete_strategy && return + + case "$cur" in + --recurse-submodules=*) + __gitcomp "$__git_fetch_recurse_submodules" "" "${cur##--recurse-submodules=}" + return + ;; + --*) + __gitcomp_builtin pull + + return + ;; + esac + __git_complete_remote_or_refspec +} + +__git_push_recurse_submodules="check on-demand only" + +__git_complete_force_with_lease () +{ + local cur_=$1 + + case "$cur_" in + --*=) + ;; + *:*) + __git_complete_refs --cur="${cur_#*:}" + ;; + *) + __git_complete_refs --cur="$cur_" + ;; + esac +} + +_git_push () +{ + case "$prev" in + --repo) + __gitcomp_nl "$(__git_remotes)" + return + ;; + --recurse-submodules) + __gitcomp "$__git_push_recurse_submodules" + return + ;; + esac + case "$cur" in + --repo=*) + __gitcomp_nl "$(__git_remotes)" "" "${cur##--repo=}" + return + ;; + --recurse-submodules=*) + __gitcomp "$__git_push_recurse_submodules" "" "${cur##--recurse-submodules=}" + return + ;; + --force-with-lease=*) + __git_complete_force_with_lease "${cur##--force-with-lease=}" + return + ;; + --*) + __gitcomp_builtin push + return + ;; + esac + __git_complete_remote_or_refspec +} + +_git_range_diff () +{ + case "$cur" in + --*) + __gitcomp " + --creation-factor= --no-dual-color + $__git_diff_common_options + " + return + ;; + esac + __git_complete_revlist +} + +__git_rebase_inprogress_options="--continue --skip --abort --quit --show-current-patch" +__git_rebase_interactive_inprogress_options="$__git_rebase_inprogress_options --edit-todo" + +_git_rebase () +{ + __git_find_repo_path + if [ -f "$__git_repo_path"/rebase-merge/interactive ]; then + __gitcomp "$__git_rebase_interactive_inprogress_options" + return + elif [ -d "$__git_repo_path"/rebase-apply ] || \ + [ -d "$__git_repo_path"/rebase-merge ]; then + __gitcomp "$__git_rebase_inprogress_options" + return + fi + __git_complete_strategy && return + case "$cur" in + --whitespace=*) + __gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}" + return + ;; + --onto=*) + __git_complete_refs --cur="${cur##--onto=}" + return + ;; + --*) + __gitcomp_builtin rebase "" \ + "$__git_rebase_interactive_inprogress_options" + + return + esac + __git_complete_refs +} + +_git_reflog () +{ + local subcommands="show delete expire" + local subcommand="$(__git_find_on_cmdline "$subcommands")" + + if [ -z "$subcommand" ]; then + __gitcomp "$subcommands" + else + __git_complete_refs + fi +} + +__git_send_email_confirm_options="always never auto cc compose" +__git_send_email_suppresscc_options="author self cc bodycc sob cccmd body all" + +_git_send_email () +{ + case "$prev" in + --to|--cc|--bcc|--from) + __gitcomp "$(__git send-email --dump-aliases)" + return + ;; + esac + + case "$cur" in + --confirm=*) + __gitcomp " + $__git_send_email_confirm_options + " "" "${cur##--confirm=}" + return + ;; + --suppress-cc=*) + __gitcomp " + $__git_send_email_suppresscc_options + " "" "${cur##--suppress-cc=}" + + return + ;; + --smtp-encryption=*) + __gitcomp "ssl tls" "" "${cur##--smtp-encryption=}" + return + ;; + --thread=*) + __gitcomp " + deep shallow + " "" "${cur##--thread=}" + return + ;; + --to=*|--cc=*|--bcc=*|--from=*) + __gitcomp "$(__git send-email --dump-aliases)" "" "${cur#--*=}" + return + ;; + --*) + __gitcomp_builtin send-email "--annotate --bcc --cc --cc-cmd --chain-reply-to + --compose --confirm= --dry-run --envelope-sender + --from --identity + --in-reply-to --no-chain-reply-to --no-signed-off-by-cc + --no-suppress-from --no-thread --quiet --reply-to + --signed-off-by-cc --smtp-pass --smtp-server + --smtp-server-port --smtp-encryption= --smtp-user + --subject --suppress-cc= --suppress-from --thread --to + --validate --no-validate + $__git_format_patch_extra_options" + return + ;; + esac + __git_complete_revlist +} + +_git_stage () +{ + _git_add +} + +_git_status () +{ + local complete_opt + local untracked_state + + case "$cur" in + --ignore-submodules=*) + __gitcomp "none untracked dirty all" "" "${cur##--ignore-submodules=}" + return + ;; + --untracked-files=*) + __gitcomp "$__git_untracked_file_modes" "" "${cur##--untracked-files=}" + return + ;; + --column=*) + __gitcomp " + always never auto column row plain dense nodense + " "" "${cur##--column=}" + return + ;; + --*) + __gitcomp_builtin status + return + ;; + esac + + untracked_state="$(__git_get_option_value "-u" "--untracked-files=" \ + "$__git_untracked_file_modes" "status.showUntrackedFiles")" + + case "$untracked_state" in + no) + # --ignored option does not matter + complete_opt= + ;; + all|normal|*) + complete_opt="--cached --directory --no-empty-directory --others" + + if [ -n "$(__git_find_on_cmdline "--ignored")" ]; then + complete_opt="$complete_opt --ignored --exclude=*" + fi + ;; + esac + + __git_complete_index_file "$complete_opt" +} + +_git_switch () +{ + local dwim_opt="$(__git_checkout_default_dwim_mode)" + + case "$prev" in + -c|-C|--orphan) + # Complete local branches (and DWIM branch + # remote branch names) for an option argument + # specifying a new branch name. This is for + # convenience, assuming new branches are + # possibly based on pre-existing branch names. + __git_complete_refs $dwim_opt --mode="heads" + return + ;; + *) + ;; + esac + + case "$cur" in + --conflict=*) + __gitcomp "diff3 merge" "" "${cur##--conflict=}" + ;; + --*) + __gitcomp_builtin switch + ;; + *) + # Unlike in git checkout, git switch --orphan does not take + # a start point. Thus we really have nothing to complete after + # the branch name. + if [ -n "$(__git_find_on_cmdline "--orphan")" ]; then + return + fi + + # At this point, we've already handled special completion for + # -c/-C, and --orphan. There are 3 main things left to + # complete: + # 1) a start-point for -c/-C or -d/--detach + # 2) a remote head, for --track + # 3) a branch name, possibly including DWIM remote branches + + if [ -n "$(__git_find_on_cmdline "-c -C -d --detach")" ]; then + __git_complete_refs --mode="refs" + elif [ -n "$(__git_find_on_cmdline "--track")" ]; then + __git_complete_refs --mode="remote-heads" + else + __git_complete_refs $dwim_opt --mode="heads" + fi + ;; + esac +} + +__git_config_get_set_variables () +{ + local prevword word config_file= c=$cword + while [ $c -gt 1 ]; do + word="${words[c]}" + case "$word" in + --system|--global|--local|--file=*) + config_file="$word" + break + ;; + -f|--file) + config_file="$word $prevword" + break + ;; + esac + prevword=$word + c=$((--c)) + done + + __git config $config_file --name-only --list +} + +__git_config_vars= +__git_compute_config_vars () +{ + test -n "$__git_config_vars" || + __git_config_vars="$(git help --config-for-completion | sort -u)" +} + +# Completes possible values of various configuration variables. +# +# Usage: __git_complete_config_variable_value [<option>]... +# --varname=<word>: The name of the configuration variable whose value is +# to be completed. Defaults to the previous word on the +# command line. +# --cur=<word>: The current value to be completed. Defaults to the current +# word to be completed. +__git_complete_config_variable_value () +{ + local varname="$prev" cur_="$cur" + + while test $# != 0; do + case "$1" in + --varname=*) varname="${1##--varname=}" ;; + --cur=*) cur_="${1##--cur=}" ;; + *) return 1 ;; + esac + shift + done + + if [ "${BASH_VERSINFO[0]:-0}" -ge 4 ]; then + varname="${varname,,}" + else + varname="$(echo "$varname" |tr A-Z a-z)" + fi + + case "$varname" in + branch.*.remote|branch.*.pushremote) + __gitcomp_nl "$(__git_remotes)" "" "$cur_" + return + ;; + branch.*.merge) + __git_complete_refs --cur="$cur_" + return + ;; + branch.*.rebase) + __gitcomp "false true merges preserve interactive" "" "$cur_" + return + ;; + remote.pushdefault) + __gitcomp_nl "$(__git_remotes)" "" "$cur_" + return + ;; + remote.*.fetch) + local remote="${varname#remote.}" + remote="${remote%.fetch}" + if [ -z "$cur_" ]; then + __gitcomp_nl "refs/heads/" "" "" "" + return + fi + __gitcomp_nl "$(__git_refs_remotes "$remote")" "" "$cur_" + return + ;; + remote.*.push) + local remote="${varname#remote.}" + remote="${remote%.push}" + __gitcomp_nl "$(__git for-each-ref \ + --format='%(refname):%(refname)' refs/heads)" "" "$cur_" + return + ;; + pull.twohead|pull.octopus) + __git_compute_merge_strategies + __gitcomp "$__git_merge_strategies" "" "$cur_" + return + ;; + color.pager) + __gitcomp "false true" "" "$cur_" + return + ;; + color.*.*) + __gitcomp " + normal black red green yellow blue magenta cyan white + bold dim ul blink reverse + " "" "$cur_" + return + ;; + color.*) + __gitcomp "false true always never auto" "" "$cur_" + return + ;; + diff.submodule) + __gitcomp "$__git_diff_submodule_formats" "" "$cur_" + return + ;; + help.format) + __gitcomp "man info web html" "" "$cur_" + return + ;; + log.date) + __gitcomp "$__git_log_date_formats" "" "$cur_" + return + ;; + sendemail.aliasfiletype) + __gitcomp "mutt mailrc pine elm gnus" "" "$cur_" + return + ;; + sendemail.confirm) + __gitcomp "$__git_send_email_confirm_options" "" "$cur_" + return + ;; + sendemail.suppresscc) + __gitcomp "$__git_send_email_suppresscc_options" "" "$cur_" + return + ;; + sendemail.transferencoding) + __gitcomp "7bit 8bit quoted-printable base64" "" "$cur_" + return + ;; + *.*) + return + ;; + esac +} + +# Completes configuration sections, subsections, variable names. +# +# Usage: __git_complete_config_variable_name [<option>]... +# --cur=<word>: The current configuration section/variable name to be +# completed. Defaults to the current word to be completed. +# --sfx=<suffix>: A suffix to be appended to each fully completed +# configuration variable name (but not to sections or +# subsections) instead of the default space. +__git_complete_config_variable_name () +{ + local cur_="$cur" sfx + + while test $# != 0; do + case "$1" in + --cur=*) cur_="${1##--cur=}" ;; + --sfx=*) sfx="${1##--sfx=}" ;; + *) return 1 ;; + esac + shift + done + + case "$cur_" in + branch.*.*) + local pfx="${cur_%.*}." + cur_="${cur_##*.}" + __gitcomp "remote pushRemote merge mergeOptions rebase" "$pfx" "$cur_" "$sfx" + return + ;; + branch.*) + local pfx="${cur%.*}." + cur_="${cur#*.}" + __gitcomp_direct "$(__git_heads "$pfx" "$cur_" ".")" + __gitcomp_nl_append $'autoSetupMerge\nautoSetupRebase\n' "$pfx" "$cur_" "$sfx" + return + ;; + guitool.*.*) + local pfx="${cur_%.*}." + cur_="${cur_##*.}" + __gitcomp " + argPrompt cmd confirm needsFile noConsole noRescan + prompt revPrompt revUnmerged title + " "$pfx" "$cur_" "$sfx" + return + ;; + difftool.*.*) + local pfx="${cur_%.*}." + cur_="${cur_##*.}" + __gitcomp "cmd path" "$pfx" "$cur_" "$sfx" + return + ;; + man.*.*) + local pfx="${cur_%.*}." + cur_="${cur_##*.}" + __gitcomp "cmd path" "$pfx" "$cur_" "$sfx" + return + ;; + mergetool.*.*) + local pfx="${cur_%.*}." + cur_="${cur_##*.}" + __gitcomp "cmd path trustExitCode" "$pfx" "$cur_" "$sfx" + return + ;; + pager.*) + local pfx="${cur_%.*}." + cur_="${cur_#*.}" + __git_compute_all_commands + __gitcomp_nl "$__git_all_commands" "$pfx" "$cur_" "$sfx" + return + ;; + remote.*.*) + local pfx="${cur_%.*}." + cur_="${cur_##*.}" + __gitcomp " + url proxy fetch push mirror skipDefaultUpdate + receivepack uploadpack tagOpt pushurl + " "$pfx" "$cur_" "$sfx" + return + ;; + remote.*) + local pfx="${cur_%.*}." + cur_="${cur_#*.}" + __gitcomp_nl "$(__git_remotes)" "$pfx" "$cur_" "." + __gitcomp_nl_append "pushDefault" "$pfx" "$cur_" "$sfx" + return + ;; + url.*.*) + local pfx="${cur_%.*}." + cur_="${cur_##*.}" + __gitcomp "insteadOf pushInsteadOf" "$pfx" "$cur_" "$sfx" + return + ;; + *.*) + __git_compute_config_vars + __gitcomp "$__git_config_vars" "" "$cur_" "$sfx" + ;; + *) + __git_compute_config_vars + __gitcomp "$(echo "$__git_config_vars" | + awk -F . '{ + sections[$1] = 1 + } + END { + for (s in sections) + print s "." + } + ')" "" "$cur_" + ;; + esac +} + +# Completes '='-separated configuration sections/variable names and values +# for 'git -c section.name=value'. +# +# Usage: __git_complete_config_variable_name_and_value [<option>]... +# --cur=<word>: The current configuration section/variable name/value to be +# completed. Defaults to the current word to be completed. +__git_complete_config_variable_name_and_value () +{ + local cur_="$cur" + + while test $# != 0; do + case "$1" in + --cur=*) cur_="${1##--cur=}" ;; + *) return 1 ;; + esac + shift + done + + case "$cur_" in + *=*) + __git_complete_config_variable_value \ + --varname="${cur_%%=*}" --cur="${cur_#*=}" + ;; + *) + __git_complete_config_variable_name --cur="$cur_" --sfx='=' + ;; + esac +} + +_git_config () +{ + case "$prev" in + --get|--get-all|--unset|--unset-all) + __gitcomp_nl "$(__git_config_get_set_variables)" + return + ;; + *.*) + __git_complete_config_variable_value + return + ;; + esac + case "$cur" in + --*) + __gitcomp_builtin config + ;; + *) + __git_complete_config_variable_name + ;; + esac +} + +_git_remote () +{ + local subcommands=" + add rename remove set-head set-branches + get-url set-url show prune update + " + local subcommand="$(__git_find_on_cmdline "$subcommands")" + if [ -z "$subcommand" ]; then + case "$cur" in + --*) + __gitcomp_builtin remote + ;; + *) + __gitcomp "$subcommands" + ;; + esac + return + fi + + case "$subcommand,$cur" in + add,--*) + __gitcomp_builtin remote_add + ;; + add,*) + ;; + set-head,--*) + __gitcomp_builtin remote_set-head + ;; + set-branches,--*) + __gitcomp_builtin remote_set-branches + ;; + set-head,*|set-branches,*) + __git_complete_remote_or_refspec + ;; + update,--*) + __gitcomp_builtin remote_update + ;; + update,*) + __gitcomp "$(__git_remotes) $(__git_get_config_variables "remotes")" + ;; + set-url,--*) + __gitcomp_builtin remote_set-url + ;; + get-url,--*) + __gitcomp_builtin remote_get-url + ;; + prune,--*) + __gitcomp_builtin remote_prune + ;; + *) + __gitcomp_nl "$(__git_remotes)" + ;; + esac +} + +_git_replace () +{ + case "$cur" in + --format=*) + __gitcomp "short medium long" "" "${cur##--format=}" + return + ;; + --*) + __gitcomp_builtin replace + return + ;; + esac + __git_complete_refs +} + +_git_rerere () +{ + local subcommands="clear forget diff remaining status gc" + local subcommand="$(__git_find_on_cmdline "$subcommands")" + if test -z "$subcommand" + then + __gitcomp "$subcommands" + return + fi +} + +_git_reset () +{ + __git_has_doubledash && return + + case "$cur" in + --*) + __gitcomp_builtin reset + return + ;; + esac + __git_complete_refs +} + +_git_restore () +{ + case "$prev" in + -s) + __git_complete_refs + return + ;; + esac + + case "$cur" in + --conflict=*) + __gitcomp "diff3 merge" "" "${cur##--conflict=}" + ;; + --source=*) + __git_complete_refs --cur="${cur##--source=}" + ;; + --*) + __gitcomp_builtin restore + ;; + esac +} + +__git_revert_inprogress_options=$__git_sequencer_inprogress_options + +_git_revert () +{ + __git_find_repo_path + if [ -f "$__git_repo_path"/REVERT_HEAD ]; then + __gitcomp "$__git_revert_inprogress_options" + return + fi + __git_complete_strategy && return + case "$cur" in + --*) + __gitcomp_builtin revert "" \ + "$__git_revert_inprogress_options" + return + ;; + esac + __git_complete_refs +} + +_git_rm () +{ + case "$cur" in + --*) + __gitcomp_builtin rm + return + ;; + esac + + __git_complete_index_file "--cached" +} + +_git_shortlog () +{ + __git_has_doubledash && return + + case "$cur" in + --*) + __gitcomp " + $__git_log_common_options + $__git_log_shortlog_options + --numbered --summary --email + " + return + ;; + esac + __git_complete_revlist +} + +_git_show () +{ + __git_has_doubledash && return + + case "$cur" in + --pretty=*|--format=*) + __gitcomp "$__git_log_pretty_formats $(__git_pretty_aliases) + " "" "${cur#*=}" + return + ;; + --diff-algorithm=*) + __gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}" + return + ;; + --submodule=*) + __gitcomp "$__git_diff_submodule_formats" "" "${cur##--submodule=}" + return + ;; + --color-moved=*) + __gitcomp "$__git_color_moved_opts" "" "${cur##--color-moved=}" + return + ;; + --color-moved-ws=*) + __gitcomp "$__git_color_moved_ws_opts" "" "${cur##--color-moved-ws=}" + return + ;; + --*) + __gitcomp "--pretty= --format= --abbrev-commit --no-abbrev-commit + --oneline --show-signature + --expand-tabs --expand-tabs= --no-expand-tabs + $__git_diff_common_options + " + return + ;; + esac + __git_complete_revlist_file +} + +_git_show_branch () +{ + case "$cur" in + --*) + __gitcomp_builtin show-branch + return + ;; + esac + __git_complete_revlist +} + +_git_sparse_checkout () +{ + local subcommands="list init set disable" + local subcommand="$(__git_find_on_cmdline "$subcommands")" + if [ -z "$subcommand" ]; then + __gitcomp "$subcommands" + return + fi + + case "$subcommand,$cur" in + init,--*) + __gitcomp "--cone" + ;; + set,--*) + __gitcomp "--stdin" + ;; + *) + ;; + esac +} + +_git_stash () +{ + local save_opts='--all --keep-index --no-keep-index --quiet --patch --include-untracked' + local subcommands='push list show apply clear drop pop create branch' + local subcommand="$(__git_find_on_cmdline "$subcommands save")" + if [ -z "$subcommand" -a -n "$(__git_find_on_cmdline "-p")" ]; then + subcommand="push" + fi + if [ -z "$subcommand" ]; then + case "$cur" in + --*) + __gitcomp "$save_opts" + ;; + sa*) + if [ -z "$(__git_find_on_cmdline "$save_opts")" ]; then + __gitcomp "save" + fi + ;; + *) + if [ -z "$(__git_find_on_cmdline "$save_opts")" ]; then + __gitcomp "$subcommands" + fi + ;; + esac + else + case "$subcommand,$cur" in + push,--*) + __gitcomp "$save_opts --message" + ;; + save,--*) + __gitcomp "$save_opts" + ;; + apply,--*|pop,--*) + __gitcomp "--index --quiet" + ;; + drop,--*) + __gitcomp "--quiet" + ;; + list,--*) + __gitcomp "--name-status --oneline --patch-with-stat" + ;; + show,--*) + __gitcomp "$__git_diff_common_options" + ;; + branch,--*) + ;; + branch,*) + if [ $cword -eq 3 ]; then + __git_complete_refs + else + __gitcomp_nl "$(__git stash list \ + | sed -n -e 's/:.*//p')" + fi + ;; + show,*|apply,*|drop,*|pop,*) + __gitcomp_nl "$(__git stash list \ + | sed -n -e 's/:.*//p')" + ;; + *) + ;; + esac + fi +} + +_git_submodule () +{ + __git_has_doubledash && return + + local subcommands="add status init deinit update set-branch set-url summary foreach sync absorbgitdirs" + local subcommand="$(__git_find_on_cmdline "$subcommands")" + if [ -z "$subcommand" ]; then + case "$cur" in + --*) + __gitcomp "--quiet" + ;; + *) + __gitcomp "$subcommands" + ;; + esac + return + fi + + case "$subcommand,$cur" in + add,--*) + __gitcomp "--branch --force --name --reference --depth" + ;; + status,--*) + __gitcomp "--cached --recursive" + ;; + deinit,--*) + __gitcomp "--force --all" + ;; + update,--*) + __gitcomp " + --init --remote --no-fetch + --recommend-shallow --no-recommend-shallow + --force --rebase --merge --reference --depth --recursive --jobs + " + ;; + set-branch,--*) + __gitcomp "--default --branch" + ;; + summary,--*) + __gitcomp "--cached --files --summary-limit" + ;; + foreach,--*|sync,--*) + __gitcomp "--recursive" + ;; + *) + ;; + esac +} + +_git_svn () +{ + local subcommands=" + init fetch clone rebase dcommit log find-rev + set-tree commit-diff info create-ignore propget + proplist show-ignore show-externals branch tag blame + migrate mkdirs reset gc + " + local subcommand="$(__git_find_on_cmdline "$subcommands")" + if [ -z "$subcommand" ]; then + __gitcomp "$subcommands" + else + local remote_opts="--username= --config-dir= --no-auth-cache" + local fc_opts=" + --follow-parent --authors-file= --repack= + --no-metadata --use-svm-props --use-svnsync-props + --log-window-size= --no-checkout --quiet + --repack-flags --use-log-author --localtime + --add-author-from + --recursive + --ignore-paths= --include-paths= $remote_opts + " + local init_opts=" + --template= --shared= --trunk= --tags= + --branches= --stdlayout --minimize-url + --no-metadata --use-svm-props --use-svnsync-props + --rewrite-root= --prefix= $remote_opts + " + local cmt_opts=" + --edit --rmdir --find-copies-harder --copy-similarity= + " + + case "$subcommand,$cur" in + fetch,--*) + __gitcomp "--revision= --fetch-all $fc_opts" + ;; + clone,--*) + __gitcomp "--revision= $fc_opts $init_opts" + ;; + init,--*) + __gitcomp "$init_opts" + ;; + dcommit,--*) + __gitcomp " + --merge --strategy= --verbose --dry-run + --fetch-all --no-rebase --commit-url + --revision --interactive $cmt_opts $fc_opts + " + ;; + set-tree,--*) + __gitcomp "--stdin $cmt_opts $fc_opts" + ;; + create-ignore,--*|propget,--*|proplist,--*|show-ignore,--*|\ + show-externals,--*|mkdirs,--*) + __gitcomp "--revision=" + ;; + log,--*) + __gitcomp " + --limit= --revision= --verbose --incremental + --oneline --show-commit --non-recursive + --authors-file= --color + " + ;; + rebase,--*) + __gitcomp " + --merge --verbose --strategy= --local + --fetch-all --dry-run $fc_opts + " + ;; + commit-diff,--*) + __gitcomp "--message= --file= --revision= $cmt_opts" + ;; + info,--*) + __gitcomp "--url" + ;; + branch,--*) + __gitcomp "--dry-run --message --tag" + ;; + tag,--*) + __gitcomp "--dry-run --message" + ;; + blame,--*) + __gitcomp "--git-format" + ;; + migrate,--*) + __gitcomp " + --config-dir= --ignore-paths= --minimize + --no-auth-cache --username= + " + ;; + reset,--*) + __gitcomp "--revision= --parent" + ;; + *) + ;; + esac + fi +} + +_git_tag () +{ + local i c=1 f=0 + while [ $c -lt $cword ]; do + i="${words[c]}" + case "$i" in + -d|--delete|-v|--verify) + __gitcomp_direct "$(__git_tags "" "$cur" " ")" + return + ;; + -f) + f=1 + ;; + esac + ((c++)) + done + + case "$prev" in + -m|-F) + ;; + -*|tag) + if [ $f = 1 ]; then + __gitcomp_direct "$(__git_tags "" "$cur" " ")" + fi + ;; + *) + __git_complete_refs + ;; + esac + + case "$cur" in + --*) + __gitcomp_builtin tag + ;; + esac +} + +_git_whatchanged () +{ + _git_log +} + +__git_complete_worktree_paths () +{ + local IFS=$'\n' + __gitcomp_nl "$(git worktree list --porcelain | + # Skip the first entry: it's the path of the main worktree, + # which can't be moved, removed, locked, etc. + sed -n -e '2,$ s/^worktree //p')" +} + +_git_worktree () +{ + local subcommands="add list lock move prune remove unlock" + local subcommand subcommand_idx + + subcommand="$(__git_find_on_cmdline --show-idx "$subcommands")" + subcommand_idx="${subcommand% *}" + subcommand="${subcommand#* }" + + case "$subcommand,$cur" in + ,*) + __gitcomp "$subcommands" + ;; + *,--*) + __gitcomp_builtin worktree_$subcommand + ;; + add,*) # usage: git worktree add [<options>] <path> [<commit-ish>] + # Here we are not completing an --option, it's either the + # path or a ref. + case "$prev" in + -b|-B) # Complete refs for branch to be created/reseted. + __git_complete_refs + ;; + -*) # The previous word is an -o|--option without an + # unstuck argument: have to complete the path for + # the new worktree, so don't list anything, but let + # Bash fall back to filename completion. + ;; + *) # The previous word is not an --option, so it must + # be either the 'add' subcommand, the unstuck + # argument of an option (e.g. branch for -b|-B), or + # the path for the new worktree. + if [ $cword -eq $((subcommand_idx+1)) ]; then + # Right after the 'add' subcommand: have to + # complete the path, so fall back to Bash + # filename completion. + : + else + case "${words[cword-2]}" in + -b|-B) # After '-b <branch>': have to + # complete the path, so fall back + # to Bash filename completion. + ;; + *) # After the path: have to complete + # the ref to be checked out. + __git_complete_refs + ;; + esac + fi + ;; + esac + ;; + lock,*|remove,*|unlock,*) + __git_complete_worktree_paths + ;; + move,*) + if [ $cword -eq $((subcommand_idx+1)) ]; then + # The first parameter must be an existing working + # tree to be moved. + __git_complete_worktree_paths + else + # The second parameter is the destination: it could + # be any path, so don't list anything, but let Bash + # fall back to filename completion. + : + fi + ;; + esac +} + +__git_complete_common () { + local command="$1" + + case "$cur" in + --*) + __gitcomp_builtin "$command" + ;; + esac +} + +__git_cmds_with_parseopt_helper= +__git_support_parseopt_helper () { + test -n "$__git_cmds_with_parseopt_helper" || + __git_cmds_with_parseopt_helper="$(__git --list-cmds=parseopt)" + + case " $__git_cmds_with_parseopt_helper " in + *" $1 "*) + return 0 + ;; + *) + return 1 + ;; + esac +} + +__git_complete_command () { + local command="$1" + local completion_func="_git_${command//-/_}" + if ! declare -f $completion_func >/dev/null 2>/dev/null && + declare -f _completion_loader >/dev/null 2>/dev/null + then + _completion_loader "git-$command" + fi + if declare -f $completion_func >/dev/null 2>/dev/null + then + $completion_func + return 0 + elif __git_support_parseopt_helper "$command" + then + __git_complete_common "$command" + return 0 + else + return 1 + fi +} + +__git_main () +{ + local i c=1 command __git_dir __git_repo_path + local __git_C_args C_args_count=0 + + while [ $c -lt $cword ]; do + i="${words[c]}" + case "$i" in + --git-dir=*) __git_dir="${i#--git-dir=}" ;; + --git-dir) ((c++)) ; __git_dir="${words[c]}" ;; + --bare) __git_dir="." ;; + --help) command="help"; break ;; + -c|--work-tree|--namespace) ((c++)) ;; + -C) __git_C_args[C_args_count++]=-C + ((c++)) + __git_C_args[C_args_count++]="${words[c]}" + ;; + -*) ;; + *) command="$i"; break ;; + esac + ((c++)) + done + + if [ -z "${command-}" ]; then + case "$prev" in + --git-dir|-C|--work-tree) + # these need a path argument, let's fall back to + # Bash filename completion + return + ;; + -c) + __git_complete_config_variable_name_and_value + return + ;; + --namespace) + # we don't support completing these options' arguments + return + ;; + esac + case "$cur" in + --*) __gitcomp " + --paginate + --no-pager + --git-dir= + --bare + --version + --exec-path + --exec-path= + --html-path + --man-path + --info-path + --work-tree= + --namespace= + --no-replace-objects + --help + " + ;; + *) + if test -n "${GIT_TESTING_PORCELAIN_COMMAND_LIST-}" + then + __gitcomp "$GIT_TESTING_PORCELAIN_COMMAND_LIST" + else + __gitcomp "$(__git --list-cmds=list-mainporcelain,others,nohelpers,alias,list-complete,config)" + fi + ;; + esac + return + fi + + __git_complete_command "$command" && return + + local expansion=$(__git_aliased_command "$command") + if [ -n "$expansion" ]; then + words[1]=$expansion + __git_complete_command "$expansion" + fi +} + +__gitk_main () +{ + __git_has_doubledash && return + + local __git_repo_path + __git_find_repo_path + + local merge="" + if [ -f "$__git_repo_path/MERGE_HEAD" ]; then + merge="--merge" + fi + case "$cur" in + --*) + __gitcomp " + $__git_log_common_options + $__git_log_gitk_options + $merge + " + return + ;; + esac + __git_complete_revlist +} + +if [[ -n ${ZSH_VERSION-} && -z ${GIT_SOURCING_ZSH_COMPLETION-} ]]; then + echo "ERROR: this script is obsolete, please see git-completion.zsh" 1>&2 + return +fi + +__git_func_wrap () +{ + local cur words cword prev + _get_comp_words_by_ref -n =: cur words cword prev + $1 +} + +# Setup completion for certain functions defined above by setting common +# variables and workarounds. +# This is NOT a public function; use at your own risk. +__git_complete () +{ + local wrapper="__git_wrap${2}" + eval "$wrapper () { __git_func_wrap $2 ; }" + complete -o bashdefault -o default -o nospace -F $wrapper $1 2>/dev/null \ + || complete -o default -o nospace -F $wrapper $1 +} + +__git_complete git __git_main +__git_complete gitk __gitk_main + +# The following are necessary only for Cygwin, and only are needed +# when the user has tab-completed the executable name and consequently +# included the '.exe' suffix. +# +if [ "$OSTYPE" = cygwin ]; then + __git_complete git.exe __git_main +fi diff --git a/.zsh/completion/git-completion.zsh b/.zsh/completion/git-completion.zsh new file mode 100644 index 0000000..6c56296 --- /dev/null +++ b/.zsh/completion/git-completion.zsh @@ -0,0 +1,294 @@ +#compdef git gitk + +# zsh completion wrapper for git +# +# Copyright (c) 2012-2020 Felipe Contreras <felipe.contreras@gmail.com> +# +# The recommended way to install this script is to make a copy of it as a +# file named '_git' inside any directory in your fpath. +# +# For example, create a directory '~/.zsh/', copy this file to '~/.zsh/_git', +# and then add the following to your ~/.zshrc file: +# +# fpath=(~/.zsh $fpath) +# +# You need git's bash completion script installed. By default bash-completion's +# location will be used (e.g. pkg-config --variable=completionsdir bash-completion). +# +# If your bash completion script is somewhere else, you can specify the +# location in your ~/.zshrc: +# +# zstyle ':completion:*:*:git:*' script ~/.git-completion.bash +# + +zstyle -T ':completion:*:*:git:*' tag-order && \ + zstyle ':completion:*:*:git:*' tag-order 'common-commands' + +zstyle -s ":completion:*:*:git:*" script script +if [ -z "$script" ]; then + local -a locations + local e bash_completion + + bash_completion=$(pkg-config --variable=completionsdir bash-completion 2>/dev/null) || + bash_completion='/usr/share/bash-completion/completions/' + + locations=( + "$(dirname ${funcsourcetrace[1]%:*})"/git-completion.bash + "$HOME/.local/share/bash-completion/completions/git" + "$bash_completion/git" + '/etc/bash_completion.d/git' # old debian + ) + for e in $locations; do + test -f $e && script="$e" && break + done +fi + +local old_complete="$functions[complete]" +functions[complete]=: +GIT_SOURCING_ZSH_COMPLETION=y . "$script" +functions[complete]="$old_complete" + +__gitcomp () +{ + emulate -L zsh + + local cur_="${3-$cur}" + + case "$cur_" in + --*=) + ;; + --no-*) + local c IFS=$' \t\n' + local -a array + for c in ${=1}; do + if [[ $c == "--" ]]; then + continue + fi + c="$c${4-}" + case $c in + --*=|*.) ;; + *) c="$c " ;; + esac + array+=("$c") + done + compset -P '*[=:]' + compadd -Q -S '' -p "${2-}" -a -- array && _ret=0 + ;; + *) + local c IFS=$' \t\n' + local -a array + for c in ${=1}; do + if [[ $c == "--" ]]; then + c="--no-...${4-}" + array+=("$c ") + break + fi + c="$c${4-}" + case $c in + --*=|*.) ;; + *) c="$c " ;; + esac + array+=("$c") + done + compset -P '*[=:]' + compadd -Q -S '' -p "${2-}" -a -- array && _ret=0 + ;; + esac +} + +__gitcomp_direct () +{ + emulate -L zsh + + compset -P '*[=:]' + compadd -Q -S '' -- ${(f)1} && _ret=0 +} + +__gitcomp_nl () +{ + emulate -L zsh + + compset -P '*[=:]' + compadd -Q -S "${4- }" -p "${2-}" -- ${(f)1} && _ret=0 +} + +__gitcomp_file () +{ + emulate -L zsh + + compset -P '*[=:]' + compadd -f -p "${2-}" -- ${(f)1} && _ret=0 +} + +__gitcomp_direct_append () +{ + __gitcomp_direct "$@" +} + +__gitcomp_nl_append () +{ + __gitcomp_nl "$@" +} + +__gitcomp_file_direct () +{ + __gitcomp_file "$1" "" +} + +_git_zsh () +{ + __gitcomp "v1.1" +} + +__git_complete_command () +{ + emulate -L zsh + + local command="$1" + local completion_func="_git_${command//-/_}" + if (( $+functions[$completion_func] )); then + emulate ksh -c $completion_func + return 0 + else + return 1 + fi +} + +__git_zsh_bash_func () +{ + emulate -L ksh + + local command=$1 + + __git_complete_command "$command" && return + + local expansion=$(__git_aliased_command "$command") + if [ -n "$expansion" ]; then + words[1]=$expansion + __git_complete_command "$expansion" + fi +} + +__git_zsh_cmd_common () +{ + local -a list + list=( + add:'add file contents to the index' + bisect:'find by binary search the change that introduced a bug' + branch:'list, create, or delete branches' + checkout:'checkout a branch or paths to the working tree' + clone:'clone a repository into a new directory' + commit:'record changes to the repository' + diff:'show changes between commits, commit and working tree, etc' + fetch:'download objects and refs from another repository' + grep:'print lines matching a pattern' + init:'create an empty Git repository or reinitialize an existing one' + log:'show commit logs' + merge:'join two or more development histories together' + mv:'move or rename a file, a directory, or a symlink' + pull:'fetch from and merge with another repository or a local branch' + push:'update remote refs along with associated objects' + rebase:'forward-port local commits to the updated upstream head' + reset:'reset current HEAD to the specified state' + restore:'restore working tree files' + rm:'remove files from the working tree and from the index' + show:'show various types of objects' + status:'show the working tree status' + switch:'switch branches' + tag:'create, list, delete or verify a tag object signed with GPG') + _describe -t common-commands 'common commands' list && _ret=0 +} + +__git_zsh_cmd_alias () +{ + local -a list + list=(${${(0)"$(git config -z --get-regexp '^alias\.*')"}#alias.}) + list=(${(f)"$(printf "%s:alias for '%s'\n" ${(f@)list})"}) + _describe -t alias-commands 'aliases' list && _ret=0 +} + +__git_zsh_cmd_all () +{ + local -a list + emulate ksh -c __git_compute_all_commands + list=( ${=__git_all_commands} ) + _describe -t all-commands 'all commands' list && _ret=0 +} + +__git_zsh_main () +{ + local curcontext="$curcontext" state state_descr line + typeset -A opt_args + local -a orig_words + + orig_words=( ${words[@]} ) + + _arguments -C \ + '(-p --paginate --no-pager)'{-p,--paginate}'[pipe all output into ''less'']' \ + '(-p --paginate)--no-pager[do not pipe git output into a pager]' \ + '--git-dir=-[set the path to the repository]: :_directories' \ + '--bare[treat the repository as a bare repository]' \ + '(- :)--version[prints the git suite version]' \ + '--exec-path=-[path to where your core git programs are installed]:: :_directories' \ + '--html-path[print the path where git''s HTML documentation is installed]' \ + '--info-path[print the path where the Info files are installed]' \ + '--man-path[print the manpath (see `man(1)`) for the man pages]' \ + '--work-tree=-[set the path to the working tree]: :_directories' \ + '--namespace=-[set the git namespace]' \ + '--no-replace-objects[do not use replacement refs to replace git objects]' \ + '(- :)--help[prints the synopsis and a list of the most commonly used commands]: :->arg' \ + '(-): :->command' \ + '(-)*:: :->arg' && return + + case $state in + (command) + _tags common-commands alias-commands all-commands + while _tags; do + _requested common-commands && __git_zsh_cmd_common + _requested alias-commands && __git_zsh_cmd_alias + _requested all-commands && __git_zsh_cmd_all + let _ret || break + done + ;; + (arg) + local command="${words[1]}" __git_dir + + if (( $+opt_args[--bare] )); then + __git_dir='.' + else + __git_dir=${opt_args[--git-dir]} + fi + + (( $+opt_args[--help] )) && command='help' + + words=( ${orig_words[@]} ) + + __git_zsh_bash_func $command + ;; + esac +} + +_git () +{ + local _ret=1 + local cur cword prev + + cur=${words[CURRENT]} + prev=${words[CURRENT-1]} + let cword=CURRENT-1 + + if (( $+functions[__${service}_zsh_main] )); then + __${service}_zsh_main + elif (( $+functions[__${service}_main] )); then + emulate ksh -c __${service}_main + elif (( $+functions[_${service}] )); then + emulate ksh -c _${service} + elif (( $+functions[_${service//-/_}] )); then + emulate ksh -c _${service//-/_} + fi + + let _ret && _default && _ret=0 + return _ret +} + +_git diff --git a/.zsh/override_bash b/.zsh/override_bash deleted file mode 100644 index e69de29..0000000 --- a/.zsh/override_bash +++ /dev/null @@ -7,6 +7,30 @@ # # Source repository: git://git.distanz.ch/dotfiles/zsh.git +# prepend custom directory to $PATH +path_prepend() +{ + local dir + for dir; do + case "$PATH" in + "*:${dir}:*"|"${dir}:*"|"*:${dir}") :;; + *) test -d "$dir" && path=("$dir" $path);; + esac + done +} + +# append custom directory to $PATH +path_append() +{ + local dir + for dir; do + case "$PATH" in + "*:${dir}:*"|"${dir}:*"|"*:${dir}") :;; + *) test -d "$dir" && path+="$dir";; + esac + done +} + # are we root? is_root() { test ${EUID:?} -eq 0 diff --git a/.zsh/zprofile/80_homebrew b/.zsh/zprofile/80_homebrew new file mode 100644 index 0000000..ca10df3 --- /dev/null +++ b/.zsh/zprofile/80_homebrew @@ -0,0 +1,14 @@ +# zshenv/80_homebrew +# +# Set variables related to Homebrew +# +# Copyright © 2022 Tobias Klauser <tklauser@distanz.ch> +# Released under the terms of the Artistic Licence 2.0 +# +# Source repository: git://git.distanz.ch/dotfiles/zsh.git + +if [ -d /opt/homebrew ]; then + eval "$(/opt/homebrew/bin/brew shellenv)" +elif [ -x /usr/local/bin/brew ]; then + eval "$(/usr/local/bin/brew shellenv)" +fi diff --git a/.zsh/zshenv/00_dirs b/.zsh/zshenv/00_dirs index c8ad727..ee08cf8 100644 --- a/.zsh/zshenv/00_dirs +++ b/.zsh/zshenv/00_dirs @@ -8,7 +8,6 @@ # Source repository: git://git.distanz.ch/dotfiles/zsh.git # -export BINDIR= export ZVARDIR=$HOME/.var/zsh # vim:ft=zsh diff --git a/.zsh/zshenv/01_fpath b/.zsh/zshenv/01_fpath index 10275bc..9deb5b4 100644 --- a/.zsh/zshenv/01_fpath +++ b/.zsh/zshenv/01_fpath @@ -9,8 +9,10 @@ # Source repository: git://git.distanz.ch/dotfiles/zsh.git fpath=($ZDOTDIR/func $fpath) - # add custom completions fpath=($ZDOTDIR/completion $fpath) +# add completitions for commands installed using homebrew +_homebrew_completions=/opt/homebrew/share/zsh/site-functions +[ -d $_homebrew_completions ] && fpath=($fpath $_homebrew_completions) # vim:ft=zsh diff --git a/.zsh/zshenv/01_path b/.zsh/zshenv/01_path index 43cf525..035a83d 100644 --- a/.zsh/zshenv/01_path +++ b/.zsh/zshenv/01_path @@ -1,6 +1,6 @@ # zshenv/01_path # -# Functions to add custom directories to the $PATH +# Add custom directories to the $PATH # # Copyright © 2011-2013 Tobias Klauser <tklauser@distanz.ch> # Copyright © 1994–2008 martin f. krafft <madduck@madduck.net> @@ -8,40 +8,9 @@ # # Source repository: git://git.distanz.ch/dotfiles/zsh.git -path_prepend() -{ - local dir - for dir; do - case "$PATH" in - "*:${dir}:*"|"${dir}:*"|"*:${dir}") :;; - *) test -d "$dir" && path=("$dir" $path);; - esac - done -} - -path_append() -{ - local dir - for dir; do - case "$PATH" in - "*:${dir}:*"|"${dir}:*"|"*:${dir}") :;; - *) test -d "$dir" && path+="$dir";; - esac - done -} - # add the paths here -path_prepend /scratch/usr/local/bin -path_prepend /opt/local/bin +path_prepend $HOME/.local/bin path_prepend $HOME/bin -path_append /opt/nios2/bin -path_append /opt/nios2mmu/x86-linux2/bin -path_prepend /opt/codesourcery/nios2-4.1-211/bin -#path_append /opt/codesourcery/arm-2010.09/bin -path_append /opt/coverity/bin -path_append /opt/linaro/gcc-linaro-arm-linux-gnueabihf/bin -path_append /opt/sourceryg++-2014.05/bin - # vim:ft=zsh diff --git a/.zsh/zshenv/60_git b/.zsh/zshenv/60_git deleted file mode 100644 index bd9a855..0000000 --- a/.zsh/zshenv/60_git +++ /dev/null @@ -1,15 +0,0 @@ -# zshenv/60_git -# -# git environment variables -# -# Copyright © 2010-2012 Tobias Klauser <tklauser@distanz.ch> -# Released under the terms of the Artistic Licence 2.0 -# -# Source repository: git://git.distanz.ch/dotfiles/zsh.git - -export GIT_AUTHOR_NAME="Tobias Klauser" -export GIT_AUTHOR_EMAIL="tklauser@distanz.ch" -export GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME" -export GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL" - -# vim:ft=zsh diff --git a/.zsh/zshenv/80_go b/.zsh/zshenv/80_go index 5c1d7d7..b7f6413 100644 --- a/.zsh/zshenv/80_go +++ b/.zsh/zshenv/80_go @@ -10,27 +10,38 @@ _GOROOT="/usr/local/go" if [ -d $_GOROOT ] ; then - export GOROOT="$_GOROOT" export GOPATH="$HOME/go" arch="$(uname -m)" case "$arch" in x86_64) export GOARCH="amd64";; i*86) export GOARCH="386";; - *) export GOARCH="unsupported";; + arm64) export GOARCH="arm64";; esac os="$(uname)" case "$os" in Linux) export GOOS="linux";; Darwin) export GOOS="darwin";; - *) export GOOS="unsupported";; esac - path_append $GOROOT/bin + path_prepend $_GOROOT/bin if [ -d $GOPATH/bin ] ; then - path_append $GOPATH/bin + path_prepend $GOPATH/bin fi fi +alias gotip=$HOME/src/go/bin/go + +# export GO111MODULE=on +# export GOPROXY=direct +# export GOSUMDB=off + +# Get all goroutine traces on panic, not just the crashing one. See +# https://github.com/maruel/panicparse#gotraceback +export GOTRACEBACK=all + +# Alweays use Go toolchains from executable path +export GOTOOLCHAIN=path + # vim:ft=zsh diff --git a/.zsh/zshenv/80_haskell b/.zsh/zshenv/80_haskell new file mode 100644 index 0000000..e39dd4b --- /dev/null +++ b/.zsh/zshenv/80_haskell @@ -0,0 +1,13 @@ +# zshenv/80_haskell +# +# Set variables related to the Haskell programming language +# +# Copyright © 2024 Tobias Klauser <tklauser@distanz.ch> +# Released under the terms of the Artistic Licence 2.0 +# +# Source repository: git://git.distanz.ch/dotfiles/zsh.git + +path_append $HOME/.cabal/bin +path_append $HOME/.ghcup/bin + +# vim:ft=zsh diff --git a/.zsh/zshenv/80_openembedded b/.zsh/zshenv/80_openembedded index 0cda09e..6ffb55e 100644 --- a/.zsh/zshenv/80_openembedded +++ b/.zsh/zshenv/80_openembedded @@ -13,6 +13,8 @@ if [ -d $OEBASE ] ; then path_append $OEBASE/bitbake/bin export BBPATH=$OEBASE/build:$OEBASE/openembedded export BB_ENV_EXTRAWHITE="OEBASE" +else + unset OEBASE fi # vim:ft=zsh diff --git a/.zsh/zshenv/80_python b/.zsh/zshenv/80_python index 251155c..4a18e9a 100644 --- a/.zsh/zshenv/80_python +++ b/.zsh/zshenv/80_python @@ -2,7 +2,7 @@ # # Set variables related to Python # -# Copyright © 2014-2016 Tobias Klauser <tklauser@distanz.ch> +# Copyright © 2014-2021 Tobias Klauser <tklauser@distanz.ch> # Released under the terms of the Artistic Licence 2.0 # # Source repository: git://git.distanz.ch/dotfiles/zsh.git @@ -10,16 +10,6 @@ #_PYTHON_USER=$HOME/.local/lib/python2.7/site-packages #[ -d $_PYTHON_USER ] && export PYTHONPATH=$_PYTHON_USER:$PYTHONPATH -_ZIPYTHON_LATEST=$HOME/tmp/ziPythonLatest/ -[ -d $_ZIPYTHON_LATEST ] && export PYTHONPATH=$PYTHONPATH:$_ZIPYTHON_LATEST - -_PYENV_ROOT="$HOME/.pyenv" -if [ -d $_PYENV_ROOT ] ; then - export PYENV_ROOT=$_PYENV_ROOT - path_prepend $PYENV_ROOT/bin - eval "$(pyenv init -)" -fi - export PYTHONSTARTUP=$HOME/.pythonrc # vim:ft=zsh diff --git a/.zsh/zshenv/80_rust b/.zsh/zshenv/80_rust index 76cac44..f53c246 100644 --- a/.zsh/zshenv/80_rust +++ b/.zsh/zshenv/80_rust @@ -7,6 +7,6 @@ # # Source repository: git://git.distanz.ch/dotfiles/zsh.git -path_append $HOME/.cargo/bin +path_prepend $HOME/.cargo/bin # vim:ft=zsh diff --git a/.zsh/zshenv/99_altera b/.zsh/zshenv/99_altera deleted file mode 100644 index bb1f531..0000000 --- a/.zsh/zshenv/99_altera +++ /dev/null @@ -1,22 +0,0 @@ -# zshenv/99_altera -# -# set up Altera specific variables -# -# Copyright © 2011-2013 Tobias Klauser <tklauser@distanz.ch> -# Released under the terms of the Artistic Licence 2.0 -# -# Source repository: git://git.distanz.ch/dotfiles/zsh.git - -ALTERADIR=/opt/altera9.1 - -if [ -d $ALTERADIR ] ; then - export LM_LICENSE_FILE=7172@rizzo.zhaw.ch - export QUARTUS_64BIT=0 - export SOPC_KIT_NIOS2=$ALTERADIR/nios2eds - export SOPC_BUILDER_PATH=$ALTERADIR/nios2eds:$ALTERADIR/ip/ddr_ddr2_sdram/lib/sopc_builder:$ALTERADIR/ip/pci_compiler/lib/sopc_builder - export QUARTUS_ROOTDIR=$ALTERADIR/quartus - export SOPC_BUILDER_PATH_80=$ALTERADIR/nios2eds - export PATH=$PATH:$ALTERADIR/quartus/bin:$ALTERADIR/nios2eds/bin:$ALTERADIR/quartus/linux:$ALTERADIR/nios2eds/bin/nios2-gnutools/H-i686-pc-linux-gnu/bin:$ALTERADIR/quartus/sopc_builder/bin -fi - -# vim:ft=zsh diff --git a/.zsh/zshenv/99_gcloud b/.zsh/zshenv/99_gcloud new file mode 100644 index 0000000..93112ae --- /dev/null +++ b/.zsh/zshenv/99_gcloud @@ -0,0 +1,15 @@ +# zshenv/99_gcloud +# +# Copyright © 2022 Tobias Klauser <tklauser@distanz.ch> +# Released under the terms of the Artistic Licence 2.0 +# +# Source repository: git://git.distanz.ch/dotfiles/zsh.git + +path_append $HOME/google-cloud-sdk/bin + +if [ -x "$(which gcloud)" ] ; then + export CLOUDSDK_COMPUTE_REGION=europe-west6 + export CLOUDSDK_COMPUTE_ZONE=europe-west6-b +fi + +# vim:ft=zsh diff --git a/.zsh/zshrc/20_compsys b/.zsh/zshrc/20_compsys index 3da9ea8..712a4ab 100644 --- a/.zsh/zshrc/20_compsys +++ b/.zsh/zshrc/20_compsys @@ -9,9 +9,21 @@ # Released under the terms of the Artistic Licence 2.0 # # Source repository: git://git.distanz.ch/dotfiles/zsh.git -# -zstyle :compinstall filename '$ZDOTDIR/zshrc/20_compsys' +zstyle :compinstall filename "$ZDOTDIR/zshrc/20_compsys" + +### INIT + +autoload -Uz compinit +compinit -d $ZVARDIR/comp-$HOST + +# load fancy completion list and menu handler +zmodload zsh/complist + +# avoid old-style completion (compctl) +zstyle ':completion:*' use-compctl false + +### OPTIONS # do not complete just at the end setopt completeinword @@ -37,13 +49,6 @@ setopt correct # be magic about adding/removing final characters on tab completion setopt auto_param_keys auto_param_slash auto_remove_slash -# load fancy completion list and menu handler -zmodload zsh/complist - -# initialise the completion system -autoload -U compinit -compinit -d $ZVARDIR/comp-$HOST - # cache results zstyle ':completion:*' use-cache on zstyle ':completion:*' cache-path $ZVARDIR/compcache @@ -65,7 +70,7 @@ zstyle ':completion:*:history-words' remove-all-dups yes zstyle ':completion:*:history-words' stop yes # match uppercase from lowercase -zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' +zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*' # ignore working and backup copies, and compiled objects #zstyle ':completion:*:(all-|)files' ignored-patterns \ @@ -134,6 +139,9 @@ zstyle ':completion:*:manuals.*' insert-sections true zstyle ':completion:*:man:*' menu yes select # provide .. as a completion -zstyle ':completion:*' special-dirs .. +zstyle ':completion:*' special-dirs true + +# automatically load bash completion functions +autoload -Uz bashcompinit && bashcompinit # vim:ft=zsh diff --git a/.zsh/zshrc/30_aliases b/.zsh/zshrc/30_aliases index 876d26c..6343989 100644 --- a/.zsh/zshrc/30_aliases +++ b/.zsh/zshrc/30_aliases @@ -18,8 +18,11 @@ alias ...='cd ../../' alias cal='cal -m' alias egrep='egrep --color=auto' alias grep='grep --color=auto' -alias m='mount' -alias u='umount' +alias ip='ip -color=auto' +# most often used commands from top10 +alias m='make' +alias g='git' +alias v='vim' # show history with timestamps (taken from oh-my-zsh) alias history='fc -El 1' @@ -45,6 +48,14 @@ alias rm='nocorrect rm' alias pylab='ipython --pylab' alias qpylab='ipython qtconsole --ConsoleWidget.font_family="Inconsolata" --ConsoleWidget.font_size=11 --colors=Linux --pylab ' +# k8s +alias k='kubectl' +alias kw='kubectl -o wide' +alias ks='kubectl -n kube-system' +alias ksw='kubectl -n kube-system -o wide' +alias wk='watch kubectl' +alias wks='watch kubectl -n kube-system' + # get top 10 shell commands alias top10='print -l ? ${(o)history%% *} | uniq -c | sort -nr | head -n 10' @@ -52,7 +63,7 @@ alias top10='print -l ? ${(o)history%% *} | uniq -c | sort -nr | head -n 10' alias bofh='fortune bofh-excuses' # Quake 3 (on the second screen) -alias q3='SDL_VIDEO_FULLSCREEN_HEAD=1 ioquake3' +alias q3='SDL_VIDEO_FULLSCREEN_HEAD=0 ioquake3' # host aliases alias distanz="ssh tklauser@distanz.ch -t \"screen -dRU\"" diff --git a/.zsh/zshrc/40_history b/.zsh/zshrc/40_history index 7017189..0e5241e 100644 --- a/.zsh/zshrc/40_history +++ b/.zsh/zshrc/40_history @@ -8,7 +8,7 @@ # Source repository: git://git.distanz.ch/dotfiles/zsh.git HISTFILE=$HOME/.zsh_history -HISTSIZE=5000 +HISTSIZE=1000000 SAVEHIST=$HISTSIZE # append history list to the history file (think multiple zsh sessions) diff --git a/.zsh/zshrc/70_vcs_info b/.zsh/zshrc/70_vcs_info index a57a33f..bb37850 100644 --- a/.zsh/zshrc/70_vcs_info +++ b/.zsh/zshrc/70_vcs_info @@ -12,9 +12,9 @@ autoload -Uz vcs_info # http://zsh.sourceforge.net/Doc/Release/User-Contributions.html#SEC273 zstyle ':vcs_info:*' actionformats \ - '%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f ' + '%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f ' zstyle ':vcs_info:*' formats \ - '%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{5}]%f ' + '%F{5}[%F{2}%b%F{5}]%f ' zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r' # disable some vcs I don't use diff --git a/.zsh/zshrc/80_prompt b/.zsh/zshrc/80_prompt index 858c166..2c84f67 100644 --- a/.zsh/zshrc/80_prompt +++ b/.zsh/zshrc/80_prompt @@ -18,19 +18,14 @@ PS2='\`%_> ' PS3='?# ' PS4='+%N:%i:%_> ' -# set variable debian_chroot if running in a chroot with /etc/debian_chroot -if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then - debian_chroot=$(cat /etc/debian_chroot) -fi - # don't use colors on dumb terminals if [[ "$TERM" == dumb ]] ; then - PROMPT="${EXITCODE}${debian_chroot:+($debian_chroot)}%n@%m%40<...<%B%~%b%<< %# " + PROMPT="${EXITCODE}%n@%m%40<...<%B%~%b%<< %# " else if (( EUID != 0 )); then - PROMPT="${RED}${EXITCODE}${WHITE}${debian_chroot:+($debian_chroot)}${RED}%n${WHITE}@%m${NO_COLOUR}:%40<...<%B%~%b%<< "'${vcs_info_msg_0_}'"%# " # primary prompt string + PROMPT="${RED}${EXITCODE}${WHITE}${RED}%n${WHITE}@%m${NO_COLOUR}:%40<...<%B%~%b%<< "'${vcs_info_msg_0_}'"%# " # primary prompt string else - PROMPT="${BLUE}${EXITCODE}${WHITE}${debian_chroot:+($debian_chroot)}${RED}%n${NO_COLOUR}@%m%40<...<%B%~%b%<< %# " # primary prompt string + PROMPT="${BLUE}${EXITCODE}${WHITE}${RED}%n${NO_COLOUR}@%m%40<...<%B%~%b%<< %# " # primary prompt string fi fi diff --git a/.zsh/zshrc/80_python b/.zsh/zshrc/80_python new file mode 100644 index 0000000..6357b52 --- /dev/null +++ b/.zsh/zshrc/80_python @@ -0,0 +1,30 @@ +# zshenv/80_python +# +# Set up tools related to Python +# +# Copyright © 2014-2022 Tobias Klauser <tklauser@distanz.ch> +# Released under the terms of the Artistic Licence 2.0 +# +# Source repository: git://git.distanz.ch/dotfiles/zsh.git + +# see https://opensource.com/article/19/5/python-3-default-mac +if command -v pyenv 1>/dev/null 2>&1; then + eval "$(pyenv init -)" +fi + +# >>> conda initialize >>> +# !! Contents within this block are managed by 'conda init' !! +__conda_setup="$('/opt/homebrew/anaconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)" +if [ $? -eq 0 ]; then + eval "$__conda_setup" +else + if [ -f "/opt/homebrew/anaconda3/etc/profile.d/conda.sh" ]; then + . "/opt/homebrew/anaconda3/etc/profile.d/conda.sh" + else + export PATH="/opt/homebrew/anaconda3/bin:$PATH" + fi +fi +unset __conda_setup +# <<< conda initialize <<< + +# vim:ft=zsh diff --git a/.zsh/zshrc/90_profiles b/.zsh/zshrc/90_profiles deleted file mode 100644 index 18ecf00..0000000 --- a/.zsh/zshrc/90_profiles +++ /dev/null @@ -1,124 +0,0 @@ -# zshrc/90_profiles -# -# set up directory specific variables and options -# -# http://michael-prokop.at/blog/2009/05/30/directory-specific-shell-configuration-with-zsh -# -# chpwd_profiles taken from grml zshrc -# -# Copyright © 2010-2017 Tobias Klauser <tklauser@distanz.ch> -# Released under the terms of the Artistic Licence 2.0 -# -# Source repository: git://git.distanz.ch/dotfiles/zsh.git - -CHPWD_PROFILE='default' - -zstyle ':chpwd:profiles:/home/tklauser/go(|/|/*)' profile distanz -zstyle ':chpwd:profiles:/home/tobiask/go(|/|/*)' profile distanz -zstyle ':chpwd:profiles:/home/tklauser/src(|/|/*)' profile distanz -zstyle ':chpwd:profiles:/home/tobiask/src(|/|/*)' profile distanz -zstyle ':chpwd:profiles:/scratch/tobiask/go(|/|/*)' profile distanz -zstyle ':chpwd:profiles:/home/tobiask/zi(|/|/*)' profile zhinst -zstyle ':chpwd:profiles:/scratch/tobiask/zi(|/|/*)' profile zhinst -zstyle ':chpwd:profiles:/scratch/yocto-zi(|/|/*)' profile zhinst - -chpwd_profile_distanz() -{ - [[ ${profile} == ${CHPWD_PROFILE} ]] && return 1 - print "chpwd(): Switching to profile: $profile" - - export GIT_AUTHOR_EMAIL="tklauser@distanz.ch" - export GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL" -} - -chpwd_profile_zhinst() -{ - [[ ${profile} == ${CHPWD_PROFILE} ]] && return 1 - print "chpwd(): Switching to profile: $profile" - - export GIT_AUTHOR_EMAIL="tobias.klauser@zhinst.com" - export GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL" -} - -function chpwd_profiles() { - # Say you want certain settings to be active in certain directories. - # This is what you want. - # - # zstyle ':chpwd:profiles:/usr/src/grml(|/|/*)' profile grml - # zstyle ':chpwd:profiles:/usr/src/debian(|/|/*)' profile debian - # - # When that's done and you enter a directory that matches the pattern - # in the third part of the context, a function called chpwd_profile_grml, - # for example, is called (if it exists). - # - # If no pattern matches (read: no profile is detected) the profile is - # set to 'default', which means chpwd_profile_default is attempted to - # be called. - # - # A word about the context (the ':chpwd:profiles:*' stuff in the zstyle - # command) which is used: The third part in the context is matched against - # ${PWD}. That's why using a pattern such as /foo/bar(|/|/*) makes sense. - # Because that way the profile is detected for all these values of ${PWD}: - # /foo/bar - # /foo/bar/ - # /foo/bar/baz - # So, if you want to make double damn sure a profile works in /foo/bar - # and everywhere deeper in that tree, just use (|/|/*) and be happy. - # - # The name of the detected profile will be available in a variable called - # 'profile' in your functions. You don't need to do anything, it'll just - # be there. - # - # Then there is the parameter $CHPWD_PROFILE is set to the profile, that - # was is currently active. That way you can avoid running code for a - # profile that is already active, by running code such as the following - # at the start of your function: - # - # function chpwd_profile_grml() { - # [[ ${profile} == ${CHPWD_PROFILE} ]] && return 1 - # ... - # } - # - # The initial value for $CHPWD_PROFILE is 'default'. - # - # Version requirement: - # This feature requires zsh 4.3.3 or newer. - # If you use this feature and need to know whether it is active in your - # current shell, there are several ways to do that. Here are two simple - # ways: - # - # a) If knowing if the profiles feature is active when zsh starts is - # good enough for you, you can put the following snippet into your - # .zshrc.local: - # - # (( ${+functions[chpwd_profiles]} )) && print "directory profiles active" - # - # b) If that is not good enough, and you would prefer to be notified - # whenever a profile changes, you can solve that by making sure you - # start *every* profile function you create like this: - # - # function chpwd_profile_myprofilename() { - # [[ ${profile} == ${CHPWD_PROFILE} ]] && return 1 - # print "chpwd(): Switching to profile: $profile" - # ... - # } - # - # That makes sure you only get notified if a profile is *changed*, - # not everytime you change directory, which would probably piss - # you off fairly quickly. :-) - # - # There you go. Now have fun with that. - local -x profile - - zstyle -s ":chpwd:profiles:${PWD}" profile profile || profile='default' - if (( ${+functions[chpwd_profile_$profile]} )) ; then - chpwd_profile_${profile} - fi - - CHPWD_PROFILE="${profile}" - return 0 -} -chpwd_functions=( ${chpwd_functions} chpwd_profiles ) - - -# vim:ft=zsh diff --git a/.zsh/zshrc/99_fzf b/.zsh/zshrc/99_fzf new file mode 100644 index 0000000..f186c06 --- /dev/null +++ b/.zsh/zshrc/99_fzf @@ -0,0 +1,22 @@ +# zshenv/99_fzf +# +# Set up fzf (https://github.com/junegunn/fzf) +# +# Copyright © 2022 Tobias Klauser <tklauser@distanz.ch> +# +# Source repository: git://git.distanz.ch/dotfiles/zsh.git + +FZF="${HOME}/.fzf" +# Installed using Homebrew +[ -d $FZF ] || FZF="/usr/local/opt/fzf" +[ -d $FZF ] || FZF="/opt/homebrew/opt/fzf" + +if [ -d $FZF ] ; then + path_append $FZF/bin + + # Auto-completion + [[ $- == *i* ]] && source "${FZF}/shell/completion.zsh" 2> /dev/null + + # Key bindings + source "${FZF}/shell/key-bindings.zsh" +fi diff --git a/.zsh/zshrc/99_gcloud b/.zsh/zshrc/99_gcloud new file mode 100644 index 0000000..9257ef9 --- /dev/null +++ b/.zsh/zshrc/99_gcloud @@ -0,0 +1,19 @@ +# zshrc/99_gcloud +# +# Copyright © 2021 Tobias Klauser <tklauser@distanz.ch> +# Released under the terms of the Artistic Licence 2.0 +# +# Source repository: git://git.distanz.ch/dotfiles/zsh.git + +if [ -f /usr/share/google-cloud-sdk/completion.zsh.inc ] ; then + source /usr/share/google-cloud-sdk/completion.zsh.inc +elif [ -f $HOME/google-cloud-sdk/completion.zsh.inc ] ; then + source $HOME/google-cloud-sdk/completion.zsh.inc +fi + +if [ -x "$(which gke-gcloud-auth-plugin)" ] ; then + # https://cloud.google.com/blog/products/containers-kubernetes/kubectl-auth-changes-in-gke + export USE_GKE_GCLOUD_AUTH_PLUGIN=True +fi + +# vim:ft=zsh |