#compdef sqlx autoload -U is-at-least _sqlx() { 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[@]}" : \ '-h[Print help]' \ '--help[Print help]' \ ":: :_sqlx_commands" \ "*::: :->sqlx-cli" \ && ret=0 case $state in (sqlx-cli) words=($line[1] "${words[@]}") (( CURRENT += 1 )) curcontext="${curcontext%:*:*}:sqlx-command-$line[1]:" case $line[1] in (database) _arguments "${_arguments_options[@]}" : \ '-h[Print help]' \ '--help[Print help]' \ ":: :_sqlx__database_commands" \ "*::: :->database" \ && ret=0 case $state in (database) words=($line[1] "${words[@]}") (( CURRENT += 1 )) curcontext="${curcontext%:*:*}:sqlx-database-command-$line[1]:" case $line[1] in (create) _arguments "${_arguments_options[@]}" : \ '-D+[Location of the DB, by default will be read from the DATABASE_URL env var or \`.env\` files]:DATABASE_URL:_default' \ '--database-url=[Location of the DB, by default will be read from the DATABASE_URL env var or \`.env\` files]:DATABASE_URL:_default' \ '--connect-timeout=[The maximum time, in seconds, to try connecting to the database server before returning an error]:CONNECT_TIMEOUT:_default' \ '--no-dotenv[Do not automatically load \`.env\` files]' \ '-h[Print help]' \ '--help[Print help]' \ && ret=0 ;; (drop) _arguments "${_arguments_options[@]}" : \ '-D+[Location of the DB, by default will be read from the DATABASE_URL env var or \`.env\` files]:DATABASE_URL:_default' \ '--database-url=[Location of the DB, by default will be read from the DATABASE_URL env var or \`.env\` files]:DATABASE_URL:_default' \ '--connect-timeout=[The maximum time, in seconds, to try connecting to the database server before returning an error]:CONNECT_TIMEOUT:_default' \ '-y[Automatic confirmation. Without this option, you will be prompted before dropping your database]' \ '--no-dotenv[Do not automatically load \`.env\` files]' \ '-f[PostgreSQL only\: force drops the database]' \ '--force[PostgreSQL only\: force drops the database]' \ '-h[Print help]' \ '--help[Print help]' \ && ret=0 ;; (reset) _arguments "${_arguments_options[@]}" : \ '--source=[Path to folder containing migrations]:SOURCE:_default' \ '-D+[Location of the DB, by default will be read from the DATABASE_URL env var or \`.env\` files]:DATABASE_URL:_default' \ '--database-url=[Location of the DB, by default will be read from the DATABASE_URL env var or \`.env\` files]:DATABASE_URL:_default' \ '--connect-timeout=[The maximum time, in seconds, to try connecting to the database server before returning an error]:CONNECT_TIMEOUT:_default' \ '-y[Automatic confirmation. Without this option, you will be prompted before dropping your database]' \ '--no-dotenv[Do not automatically load \`.env\` files]' \ '-f[PostgreSQL only\: force drops the database]' \ '--force[PostgreSQL only\: force drops the database]' \ '-h[Print help]' \ '--help[Print help]' \ && ret=0 ;; (setup) _arguments "${_arguments_options[@]}" : \ '--source=[Path to folder containing migrations]:SOURCE:_default' \ '-D+[Location of the DB, by default will be read from the DATABASE_URL env var or \`.env\` files]:DATABASE_URL:_default' \ '--database-url=[Location of the DB, by default will be read from the DATABASE_URL env var or \`.env\` files]:DATABASE_URL:_default' \ '--connect-timeout=[The maximum time, in seconds, to try connecting to the database server before returning an error]:CONNECT_TIMEOUT:_default' \ '--no-dotenv[Do not automatically load \`.env\` files]' \ '-h[Print help]' \ '--help[Print help]' \ && ret=0 ;; (help) _arguments "${_arguments_options[@]}" : \ ":: :_sqlx__database__help_commands" \ "*::: :->help" \ && ret=0 case $state in (help) words=($line[1] "${words[@]}") (( CURRENT += 1 )) curcontext="${curcontext%:*:*}:sqlx-database-help-command-$line[1]:" case $line[1] in (create) _arguments "${_arguments_options[@]}" : \ && ret=0 ;; (drop) _arguments "${_arguments_options[@]}" : \ && ret=0 ;; (reset) _arguments "${_arguments_options[@]}" : \ && ret=0 ;; (setup) _arguments "${_arguments_options[@]}" : \ && ret=0 ;; (help) _arguments "${_arguments_options[@]}" : \ && ret=0 ;; esac ;; esac ;; esac ;; esac ;; (prepare) _arguments "${_arguments_options[@]}" : \ '-D+[Location of the DB, by default will be read from the DATABASE_URL env var or \`.env\` files]:DATABASE_URL:_default' \ '--database-url=[Location of the DB, by default will be read from the DATABASE_URL env var or \`.env\` files]:DATABASE_URL:_default' \ '--connect-timeout=[The maximum time, in seconds, to try connecting to the database server before returning an error]:CONNECT_TIMEOUT:_default' \ '--check[Run in '\''check'\'' mode. Exits with 0 if the query metadata is up-to-date. Exits with 1 if the query metadata needs updating]' \ '--all[Prepare query macros in dependencies that exist outside the current crate or workspace]' \ '--workspace[Generate a single workspace-level \`.sqlx\` folder]' \ '--no-dotenv[Do not automatically load \`.env\` files]' \ '-h[Print help (see more with '\''--help'\'')]' \ '--help[Print help (see more with '\''--help'\'')]' \ '*::args -- Arguments to be passed to `cargo rustc ...`:_default' \ && ret=0 ;; (migrate) _arguments "${_arguments_options[@]}" : \ '-h[Print help]' \ '--help[Print help]' \ ":: :_sqlx__migrate_commands" \ "*::: :->migrate" \ && ret=0 case $state in (migrate) words=($line[1] "${words[@]}") (( CURRENT += 1 )) curcontext="${curcontext%:*:*}:sqlx-migrate-command-$line[1]:" case $line[1] in (add) _arguments "${_arguments_options[@]}" : \ '--source=[Path to folder containing migrations]:SOURCE:_default' \ '-r[If true, creates a pair of up and down migration files with same version else creates a single sql file]' \ '-t[If set, use timestamp versioning for the new migration. Conflicts with \`--sequential\`]' \ '--timestamp[If set, use timestamp versioning for the new migration. Conflicts with \`--sequential\`]' \ '(-t --timestamp)-s[If set, use sequential versioning for the new migration. Conflicts with \`--timestamp\`]' \ '(-t --timestamp)--sequential[If set, use sequential versioning for the new migration. Conflicts with \`--timestamp\`]' \ '-h[Print help (see more with '\''--help'\'')]' \ '--help[Print help (see more with '\''--help'\'')]' \ ':description:_default' \ && ret=0 ;; (run) _arguments "${_arguments_options[@]}" : \ '--source=[Path to folder containing migrations]:SOURCE:_default' \ '-D+[Location of the DB, by default will be read from the DATABASE_URL env var or \`.env\` files]:DATABASE_URL:_default' \ '--database-url=[Location of the DB, by default will be read from the DATABASE_URL env var or \`.env\` files]:DATABASE_URL:_default' \ '--connect-timeout=[The maximum time, in seconds, to try connecting to the database server before returning an error]:CONNECT_TIMEOUT:_default' \ '--target-version=[Apply migrations up to the specified version. If unspecified, apply all pending migrations. If already at the target version, then no-op]:TARGET_VERSION:_default' \ '--dry-run[List all the migrations to be run without applying]' \ '--ignore-missing[Ignore applied migrations that are missing in the resolved migrations]' \ '--no-dotenv[Do not automatically load \`.env\` files]' \ '-h[Print help]' \ '--help[Print help]' \ && ret=0 ;; (revert) _arguments "${_arguments_options[@]}" : \ '--source=[Path to folder containing migrations]:SOURCE:_default' \ '-D+[Location of the DB, by default will be read from the DATABASE_URL env var or \`.env\` files]:DATABASE_URL:_default' \ '--database-url=[Location of the DB, by default will be read from the DATABASE_URL env var or \`.env\` files]:DATABASE_URL:_default' \ '--connect-timeout=[The maximum time, in seconds, to try connecting to the database server before returning an error]:CONNECT_TIMEOUT:_default' \ '--target-version=[Revert migrations down to the specified version. If unspecified, revert only the last migration. Set to 0 to revert all migrations. If already at the target version, then no-op]:TARGET_VERSION:_default' \ '--dry-run[List the migration to be reverted without applying]' \ '--ignore-missing[Ignore applied migrations that are missing in the resolved migrations]' \ '--no-dotenv[Do not automatically load \`.env\` files]' \ '-h[Print help]' \ '--help[Print help]' \ && ret=0 ;; (info) _arguments "${_arguments_options[@]}" : \ '--source=[Path to folder containing migrations]:SOURCE:_default' \ '-D+[Location of the DB, by default will be read from the DATABASE_URL env var or \`.env\` files]:DATABASE_URL:_default' \ '--database-url=[Location of the DB, by default will be read from the DATABASE_URL env var or \`.env\` files]:DATABASE_URL:_default' \ '--connect-timeout=[The maximum time, in seconds, to try connecting to the database server before returning an error]:CONNECT_TIMEOUT:_default' \ '--no-dotenv[Do not automatically load \`.env\` files]' \ '-h[Print help]' \ '--help[Print help]' \ && ret=0 ;; (build-script) _arguments "${_arguments_options[@]}" : \ '--source=[Path to folder containing migrations]:SOURCE:_default' \ '--force[Overwrite the build script if it already exists]' \ '-h[Print help (see more with '\''--help'\'')]' \ '--help[Print help (see more with '\''--help'\'')]' \ && ret=0 ;; (help) _arguments "${_arguments_options[@]}" : \ ":: :_sqlx__migrate__help_commands" \ "*::: :->help" \ && ret=0 case $state in (help) words=($line[1] "${words[@]}") (( CURRENT += 1 )) curcontext="${curcontext%:*:*}:sqlx-migrate-help-command-$line[1]:" case $line[1] in (add) _arguments "${_arguments_options[@]}" : \ && ret=0 ;; (run) _arguments "${_arguments_options[@]}" : \ && ret=0 ;; (revert) _arguments "${_arguments_options[@]}" : \ && ret=0 ;; (info) _arguments "${_arguments_options[@]}" : \ && ret=0 ;; (build-script) _arguments "${_arguments_options[@]}" : \ && ret=0 ;; (help) _arguments "${_arguments_options[@]}" : \ && ret=0 ;; esac ;; esac ;; esac ;; esac ;; (completions) _arguments "${_arguments_options[@]}" : \ '-h[Print help]' \ '--help[Print help]' \ ':shell:(bash elvish fish powershell zsh)' \ && ret=0 ;; (help) _arguments "${_arguments_options[@]}" : \ ":: :_sqlx__help_commands" \ "*::: :->help" \ && ret=0 case $state in (help) words=($line[1] "${words[@]}") (( CURRENT += 1 )) curcontext="${curcontext%:*:*}:sqlx-help-command-$line[1]:" case $line[1] in (database) _arguments "${_arguments_options[@]}" : \ ":: :_sqlx__help__database_commands" \ "*::: :->database" \ && ret=0 case $state in (database) words=($line[1] "${words[@]}") (( CURRENT += 1 )) curcontext="${curcontext%:*:*}:sqlx-help-database-command-$line[1]:" case $line[1] in (create) _arguments "${_arguments_options[@]}" : \ && ret=0 ;; (drop) _arguments "${_arguments_options[@]}" : \ && ret=0 ;; (reset) _arguments "${_arguments_options[@]}" : \ && ret=0 ;; (setup) _arguments "${_arguments_options[@]}" : \ && ret=0 ;; esac ;; esac ;; (prepare) _arguments "${_arguments_options[@]}" : \ && ret=0 ;; (migrate) _arguments "${_arguments_options[@]}" : \ ":: :_sqlx__help__migrate_commands" \ "*::: :->migrate" \ && ret=0 case $state in (migrate) words=($line[1] "${words[@]}") (( CURRENT += 1 )) curcontext="${curcontext%:*:*}:sqlx-help-migrate-command-$line[1]:" case $line[1] in (add) _arguments "${_arguments_options[@]}" : \ && ret=0 ;; (run) _arguments "${_arguments_options[@]}" : \ && ret=0 ;; (revert) _arguments "${_arguments_options[@]}" : \ && ret=0 ;; (info) _arguments "${_arguments_options[@]}" : \ && ret=0 ;; (build-script) _arguments "${_arguments_options[@]}" : \ && ret=0 ;; esac ;; esac ;; (completions) _arguments "${_arguments_options[@]}" : \ && ret=0 ;; (help) _arguments "${_arguments_options[@]}" : \ && ret=0 ;; esac ;; esac ;; esac ;; esac } (( $+functions[_sqlx_commands] )) || _sqlx_commands() { local commands; commands=( 'database:Group of commands for creating and dropping your database' \ 'prepare:Generate query metadata to support offline compile-time verification' \ 'migrate:Group of commands for creating and running migrations' \ 'completions:Generate shell completions for the specified shell' \ 'help:Print this message or the help of the given subcommand(s)' \ ) _describe -t commands 'sqlx commands' commands "$@" } (( $+functions[_sqlx__completions_commands] )) || _sqlx__completions_commands() { local commands; commands=() _describe -t commands 'sqlx completions commands' commands "$@" } (( $+functions[_sqlx__database_commands] )) || _sqlx__database_commands() { local commands; commands=( 'create:Creates the database specified in your DATABASE_URL' \ 'drop:Drops the database specified in your DATABASE_URL' \ 'reset:Drops the database specified in your DATABASE_URL, re-creates it, and runs any pending migrations' \ 'setup:Creates the database specified in your DATABASE_URL and runs any pending migrations' \ 'help:Print this message or the help of the given subcommand(s)' \ ) _describe -t commands 'sqlx database commands' commands "$@" } (( $+functions[_sqlx__database__create_commands] )) || _sqlx__database__create_commands() { local commands; commands=() _describe -t commands 'sqlx database create commands' commands "$@" } (( $+functions[_sqlx__database__drop_commands] )) || _sqlx__database__drop_commands() { local commands; commands=() _describe -t commands 'sqlx database drop commands' commands "$@" } (( $+functions[_sqlx__database__help_commands] )) || _sqlx__database__help_commands() { local commands; commands=( 'create:Creates the database specified in your DATABASE_URL' \ 'drop:Drops the database specified in your DATABASE_URL' \ 'reset:Drops the database specified in your DATABASE_URL, re-creates it, and runs any pending migrations' \ 'setup:Creates the database specified in your DATABASE_URL and runs any pending migrations' \ 'help:Print this message or the help of the given subcommand(s)' \ ) _describe -t commands 'sqlx database help commands' commands "$@" } (( $+functions[_sqlx__database__help__create_commands] )) || _sqlx__database__help__create_commands() { local commands; commands=() _describe -t commands 'sqlx database help create commands' commands "$@" } (( $+functions[_sqlx__database__help__drop_commands] )) || _sqlx__database__help__drop_commands() { local commands; commands=() _describe -t commands 'sqlx database help drop commands' commands "$@" } (( $+functions[_sqlx__database__help__help_commands] )) || _sqlx__database__help__help_commands() { local commands; commands=() _describe -t commands 'sqlx database help help commands' commands "$@" } (( $+functions[_sqlx__database__help__reset_commands] )) || _sqlx__database__help__reset_commands() { local commands; commands=() _describe -t commands 'sqlx database help reset commands' commands "$@" } (( $+functions[_sqlx__database__help__setup_commands] )) || _sqlx__database__help__setup_commands() { local commands; commands=() _describe -t commands 'sqlx database help setup commands' commands "$@" } (( $+functions[_sqlx__database__reset_commands] )) || _sqlx__database__reset_commands() { local commands; commands=() _describe -t commands 'sqlx database reset commands' commands "$@" } (( $+functions[_sqlx__database__setup_commands] )) || _sqlx__database__setup_commands() { local commands; commands=() _describe -t commands 'sqlx database setup commands' commands "$@" } (( $+functions[_sqlx__help_commands] )) || _sqlx__help_commands() { local commands; commands=( 'database:Group of commands for creating and dropping your database' \ 'prepare:Generate query metadata to support offline compile-time verification' \ 'migrate:Group of commands for creating and running migrations' \ 'completions:Generate shell completions for the specified shell' \ 'help:Print this message or the help of the given subcommand(s)' \ ) _describe -t commands 'sqlx help commands' commands "$@" } (( $+functions[_sqlx__help__completions_commands] )) || _sqlx__help__completions_commands() { local commands; commands=() _describe -t commands 'sqlx help completions commands' commands "$@" } (( $+functions[_sqlx__help__database_commands] )) || _sqlx__help__database_commands() { local commands; commands=( 'create:Creates the database specified in your DATABASE_URL' \ 'drop:Drops the database specified in your DATABASE_URL' \ 'reset:Drops the database specified in your DATABASE_URL, re-creates it, and runs any pending migrations' \ 'setup:Creates the database specified in your DATABASE_URL and runs any pending migrations' \ ) _describe -t commands 'sqlx help database commands' commands "$@" } (( $+functions[_sqlx__help__database__create_commands] )) || _sqlx__help__database__create_commands() { local commands; commands=() _describe -t commands 'sqlx help database create commands' commands "$@" } (( $+functions[_sqlx__help__database__drop_commands] )) || _sqlx__help__database__drop_commands() { local commands; commands=() _describe -t commands 'sqlx help database drop commands' commands "$@" } (( $+functions[_sqlx__help__database__reset_commands] )) || _sqlx__help__database__reset_commands() { local commands; commands=() _describe -t commands 'sqlx help database reset commands' commands "$@" } (( $+functions[_sqlx__help__database__setup_commands] )) || _sqlx__help__database__setup_commands() { local commands; commands=() _describe -t commands 'sqlx help database setup commands' commands "$@" } (( $+functions[_sqlx__help__help_commands] )) || _sqlx__help__help_commands() { local commands; commands=() _describe -t commands 'sqlx help help commands' commands "$@" } (( $+functions[_sqlx__help__migrate_commands] )) || _sqlx__help__migrate_commands() { local commands; commands=( 'add:Create a new migration with the given description' \ 'run:Run all pending migrations' \ 'revert:Revert the latest migration with a down file' \ 'info:List all available migrations' \ 'build-script:Generate a \`build.rs\` to trigger recompilation when a new migration is added' \ ) _describe -t commands 'sqlx help migrate commands' commands "$@" } (( $+functions[_sqlx__help__migrate__add_commands] )) || _sqlx__help__migrate__add_commands() { local commands; commands=() _describe -t commands 'sqlx help migrate add commands' commands "$@" } (( $+functions[_sqlx__help__migrate__build-script_commands] )) || _sqlx__help__migrate__build-script_commands() { local commands; commands=() _describe -t commands 'sqlx help migrate build-script commands' commands "$@" } (( $+functions[_sqlx__help__migrate__info_commands] )) || _sqlx__help__migrate__info_commands() { local commands; commands=() _describe -t commands 'sqlx help migrate info commands' commands "$@" } (( $+functions[_sqlx__help__migrate__revert_commands] )) || _sqlx__help__migrate__revert_commands() { local commands; commands=() _describe -t commands 'sqlx help migrate revert commands' commands "$@" } (( $+functions[_sqlx__help__migrate__run_commands] )) || _sqlx__help__migrate__run_commands() { local commands; commands=() _describe -t commands 'sqlx help migrate run commands' commands "$@" } (( $+functions[_sqlx__help__prepare_commands] )) || _sqlx__help__prepare_commands() { local commands; commands=() _describe -t commands 'sqlx help prepare commands' commands "$@" } (( $+functions[_sqlx__migrate_commands] )) || _sqlx__migrate_commands() { local commands; commands=( 'add:Create a new migration with the given description' \ 'run:Run all pending migrations' \ 'revert:Revert the latest migration with a down file' \ 'info:List all available migrations' \ 'build-script:Generate a \`build.rs\` to trigger recompilation when a new migration is added' \ 'help:Print this message or the help of the given subcommand(s)' \ ) _describe -t commands 'sqlx migrate commands' commands "$@" } (( $+functions[_sqlx__migrate__add_commands] )) || _sqlx__migrate__add_commands() { local commands; commands=() _describe -t commands 'sqlx migrate add commands' commands "$@" } (( $+functions[_sqlx__migrate__build-script_commands] )) || _sqlx__migrate__build-script_commands() { local commands; commands=() _describe -t commands 'sqlx migrate build-script commands' commands "$@" } (( $+functions[_sqlx__migrate__help_commands] )) || _sqlx__migrate__help_commands() { local commands; commands=( 'add:Create a new migration with the given description' \ 'run:Run all pending migrations' \ 'revert:Revert the latest migration with a down file' \ 'info:List all available migrations' \ 'build-script:Generate a \`build.rs\` to trigger recompilation when a new migration is added' \ 'help:Print this message or the help of the given subcommand(s)' \ ) _describe -t commands 'sqlx migrate help commands' commands "$@" } (( $+functions[_sqlx__migrate__help__add_commands] )) || _sqlx__migrate__help__add_commands() { local commands; commands=() _describe -t commands 'sqlx migrate help add commands' commands "$@" } (( $+functions[_sqlx__migrate__help__build-script_commands] )) || _sqlx__migrate__help__build-script_commands() { local commands; commands=() _describe -t commands 'sqlx migrate help build-script commands' commands "$@" } (( $+functions[_sqlx__migrate__help__help_commands] )) || _sqlx__migrate__help__help_commands() { local commands; commands=() _describe -t commands 'sqlx migrate help help commands' commands "$@" } (( $+functions[_sqlx__migrate__help__info_commands] )) || _sqlx__migrate__help__info_commands() { local commands; commands=() _describe -t commands 'sqlx migrate help info commands' commands "$@" } (( $+functions[_sqlx__migrate__help__revert_commands] )) || _sqlx__migrate__help__revert_commands() { local commands; commands=() _describe -t commands 'sqlx migrate help revert commands' commands "$@" } (( $+functions[_sqlx__migrate__help__run_commands] )) || _sqlx__migrate__help__run_commands() { local commands; commands=() _describe -t commands 'sqlx migrate help run commands' commands "$@" } (( $+functions[_sqlx__migrate__info_commands] )) || _sqlx__migrate__info_commands() { local commands; commands=() _describe -t commands 'sqlx migrate info commands' commands "$@" } (( $+functions[_sqlx__migrate__revert_commands] )) || _sqlx__migrate__revert_commands() { local commands; commands=() _describe -t commands 'sqlx migrate revert commands' commands "$@" } (( $+functions[_sqlx__migrate__run_commands] )) || _sqlx__migrate__run_commands() { local commands; commands=() _describe -t commands 'sqlx migrate run commands' commands "$@" } (( $+functions[_sqlx__prepare_commands] )) || _sqlx__prepare_commands() { local commands; commands=() _describe -t commands 'sqlx prepare commands' commands "$@" } if [ "$funcstack[1]" = "_sqlx" ]; then _sqlx "$@" else compdef _sqlx sqlx fi