123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- #compdef scratch
- # AUTOMATICALLY GENERATED by `shtab`
- _shtab_scratch_commands() {
- local _commands=(
- "completion:Generate shell completion script"
- "create:Create a new scratch instance"
- "destroy:Destroy a scratch instance"
- "forward:Forward local ports remotely"
- "login:Log in to AWS SSO"
- "mine:Show active scratch instance"
- "push:Push current HEAD (or a specific git commit) to scratch instance"
- "sftp:Connect to scratch instance via sftp"
- "ssh:Connect to scratch instance via ssh"
- )
- _describe 'scratch commands' _commands
- }
- _shtab_scratch_options=(
- "(- : *)"{-h,--help}"[show this help message and exit]"
- )
- _shtab_scratch_completion_options=(
- "(- : *)"{-h,--help}"[show this help message and exit]"
- ":print shell completion script:(bash zsh tcsh)"
- ":print shell completion script:(bash zsh tcsh)"
- )
- _shtab_scratch_create_options=(
- "(- : *)"{-h,--help}"[show this help message and exit]"
- "--key-name[Optional EC2 Key Pair name]:key_name:"
- "--security-group-name[EC2 Security Group name. Defaults to Materialize scratch account.]:security_group_name:"
- "--extra-tags[Additional EC2 tags for created instance. Format\: \{\"key\", \"value\"\}]:extra_tags:"
- "--instance-profile[EC2 instance profile \/ IAM role. Defaults to \`admin-instance\`.]:instance_profile:"
- "--output-format[]:output_format:(table csv)"
- "--git-rev[Git revision of \`materialize\` codebase to push to scratch instance. Defaults to \`HEAD\`]:git_rev:"
- "--ssh[ssh into the machine after the launch script is run. Only works if a single instance was started]"
- "--max-age-days[Maximum age for scratch instance in days. Defaults to 1.5]:max_age_days:"
- ":Use a config from \{machine\}.json in \`misc\/scratch\`. Hint\: \`dev-box\` is a good starter\!:"
- )
- _shtab_scratch_destroy_options=(
- "(- : *)"{-h,--help}"[show this help message and exit]"
- "--all-mine[Destroy all of your instances (incompatible with specifying instance IDs)]"
- {-y,--yes}"[Don\'t ask for confirmation before destroying]"
- "--output-format[]:output_format:(table csv)"
- "(*)::Instance IDs to destroy:"
- )
- _shtab_scratch_forward_options=(
- "(- : *)"{-h,--help}"[show this help message and exit]"
- ":The ID of the instance to connect to, or \'mine\' to specify your only live instance:"
- "(*)::The remote ports to forward locally:"
- )
- _shtab_scratch_login_options=(
- "(- : *)"{-h,--help}"[show this help message and exit]"
- )
- _shtab_scratch_mine_options=(
- "(- : *)"{-h,--help}"[show this help message and exit]"
- "--all[Show all instances]"
- "--output-format[]:output_format:(table csv)"
- "(*)::Whose instances to show (defaults to yourself):"
- )
- _shtab_scratch_push_options=(
- "(- : *)"{-h,--help}"[show this help message and exit]"
- "--rev[The git rev to checkout]:rev:"
- ":The ID of the instance to connect to, or \'mine\' to specify your only live instance:"
- )
- _shtab_scratch_sftp_options=(
- "(- : *)"{-h,--help}"[show this help message and exit]"
- ":The ID of the instance to connect to, or \'mine\' to specify your only live instance:"
- )
- _shtab_scratch_ssh_options=(
- "(- : *)"{-h,--help}"[show this help message and exit]"
- ":The ID of the instance to connect to, or \'mine\' to specify your only live instance:"
- "(*)::The command to run via SSH, if any:"
- )
- _shtab_scratch() {
- local context state line curcontext="$curcontext" one_or_more='(-)*' remainder='(*)'
- if ((${_shtab_scratch_options[(I)${(q)one_or_more}*]} + ${_shtab_scratch_options[(I)${(q)remainder}*]} == 0)); then # noqa: E501
- _shtab_scratch_options+=(': :_shtab_scratch_commands' '*::: :->scratch')
- fi
- _arguments -C -s $_shtab_scratch_options
- case $state in
- scratch)
- words=($line[1] "${words[@]}")
- (( CURRENT += 1 ))
- curcontext="${curcontext%:*:*}:_shtab_scratch-$line[1]:"
- case $line[1] in
- completion) _arguments -C -s $_shtab_scratch_completion_options ;;
- create) _arguments -C -s $_shtab_scratch_create_options ;;
- destroy) _arguments -C -s $_shtab_scratch_destroy_options ;;
- forward) _arguments -C -s $_shtab_scratch_forward_options ;;
- login) _arguments -C -s $_shtab_scratch_login_options ;;
- mine) _arguments -C -s $_shtab_scratch_mine_options ;;
- push) _arguments -C -s $_shtab_scratch_push_options ;;
- sftp) _arguments -C -s $_shtab_scratch_sftp_options ;;
- ssh) _arguments -C -s $_shtab_scratch_ssh_options ;;
- esac
- esac
- }
- typeset -A opt_args
- if [[ $zsh_eval_context[-1] == eval ]]; then
- # eval/source/. command, register function for later
- compdef _shtab_scratch -N scratch
- else
- # autoload from fpath, call function directly
- _shtab_scratch "$@"
- fi
|