|
| 1 | +# stackql-deploy completions for fish |
| 2 | + |
| 3 | +# Remove any existing completions |
| 4 | +complete -c stackql-deploy -e |
| 5 | + |
| 6 | +# Main commands |
| 7 | +complete -c stackql-deploy -n "__fish_use_subcommand" -a "build" -d "Create or update resources" |
| 8 | +complete -c stackql-deploy -n "__fish_use_subcommand" -a "test" -d "Run test queries for the stack" |
| 9 | +complete -c stackql-deploy -n "__fish_use_subcommand" -a "teardown" -d "Teardown a provisioned stack" |
| 10 | +complete -c stackql-deploy -n "__fish_use_subcommand" -a "info" -d "Display version information" |
| 11 | +complete -c stackql-deploy -n "__fish_use_subcommand" -a "init" -d "Initialize a new project structure" |
| 12 | +complete -c stackql-deploy -n "__fish_use_subcommand" -a "upgrade" -d "Upgrade pystackql and stackql binary" |
| 13 | +complete -c stackql-deploy -n "__fish_use_subcommand" -a "shell" -d "Launch the stackql shell" |
| 14 | +complete -c stackql-deploy -n "__fish_use_subcommand" -a "completion" -d "Install tab completion" |
| 15 | + |
| 16 | +# Common options for build/test/teardown |
| 17 | +set -l common_cmds "build test teardown" |
| 18 | + |
| 19 | +# --log-level |
| 20 | +complete -c stackql-deploy -n "__fish_seen_subcommand_from $common_cmds" -l log-level -d "Set logging level" -a "DEBUG INFO WARNING ERROR CRITICAL" |
| 21 | + |
| 22 | +# --env-file |
| 23 | +complete -c stackql-deploy -n "__fish_seen_subcommand_from $common_cmds" -l env-file -d "Environment variables file" -r -F |
| 24 | + |
| 25 | +# -e/--env |
| 26 | +complete -c stackql-deploy -n "__fish_seen_subcommand_from $common_cmds" -s e -l env -d "Set additional environment variables" |
| 27 | + |
| 28 | +# --dry-run |
| 29 | +complete -c stackql-deploy -n "__fish_seen_subcommand_from $common_cmds" -l dry-run -d "Perform a dry run" |
| 30 | + |
| 31 | +# --show-queries |
| 32 | +complete -c stackql-deploy -n "__fish_seen_subcommand_from $common_cmds" -l show-queries -d "Show queries in output logs" |
| 33 | + |
| 34 | +# --on-failure |
| 35 | +complete -c stackql-deploy -n "__fish_seen_subcommand_from $common_cmds" -l on-failure -d "Action on failure" -a "rollback ignore error" |
| 36 | + |
| 37 | +# --custom-registry |
| 38 | +complete -c stackql-deploy -n "__fish_seen_subcommand_from $common_cmds" -l custom-registry -d "Custom registry URL" |
| 39 | + |
| 40 | +# --download-dir |
| 41 | +complete -c stackql-deploy -n "__fish_seen_subcommand_from $common_cmds" -l download-dir -d "Download directory" -r -a "(__fish_complete_directories)" |
| 42 | + |
| 43 | +# --help |
| 44 | +complete -c stackql-deploy -n "__fish_seen_subcommand_from $common_cmds" -l help -d "Show help message" |
| 45 | + |
| 46 | +# build/test/teardown positional arguments |
| 47 | +complete -c stackql-deploy -n "__fish_seen_subcommand_from $common_cmds; and not __fish_seen_argument -l log-level -l env-file -s e -l env -l dry-run -l show-queries -l on-failure -l custom-registry -l download-dir" -a "(__fish_complete_directories)" -d "Stack directory" |
| 48 | + |
| 49 | +# Environment names (for second positional argument) |
| 50 | +function __stackql_deploy_needs_env |
| 51 | + set -l cmd (commandline -opc) |
| 52 | + set -l cmd_count (count $cmd) |
| 53 | + # If we have: stackql-deploy build <dir> [<here>] |
| 54 | + if test $cmd_count -ge 3 |
| 55 | + set -l has_opts 0 |
| 56 | + for arg in $cmd[3..-1] |
| 57 | + if string match -q -- '-*' $arg |
| 58 | + set has_opts 1 |
| 59 | + break |
| 60 | + end |
| 61 | + end |
| 62 | + if test $has_opts -eq 0 |
| 63 | + return 0 |
| 64 | + end |
| 65 | + end |
| 66 | + return 1 |
| 67 | +end |
| 68 | + |
| 69 | +complete -c stackql-deploy -n "__fish_seen_subcommand_from $common_cmds; and __stackql_deploy_needs_env" -a "dev staging prod test prd sit uat" -d "Environment" |
| 70 | + |
| 71 | +# init command |
| 72 | +complete -c stackql-deploy -n "__fish_seen_subcommand_from init" -l provider -d "Specify provider" -a "aws google azure" |
| 73 | +complete -c stackql-deploy -n "__fish_seen_subcommand_from init" -l help -d "Show help message" |
| 74 | + |
| 75 | +# completion command |
| 76 | +complete -c stackql-deploy -n "__fish_seen_subcommand_from completion" -a "bash zsh fish powershell" -d "Shell type" |
| 77 | +complete -c stackql-deploy -n "__fish_seen_subcommand_from completion" -l install -d "Install completion" |
| 78 | +complete -c stackql-deploy -n "__fish_seen_subcommand_from completion" -l help -d "Show help message" |
| 79 | + |
| 80 | +# info/upgrade/shell commands |
| 81 | +complete -c stackql-deploy -n "__fish_seen_subcommand_from info upgrade shell" -l help -d "Show help message" |
| 82 | +complete -c stackql-deploy -n "__fish_seen_subcommand_from info upgrade shell" -l custom-registry -d "Custom registry URL" |
| 83 | +complete -c stackql-deploy -n "__fish_seen_subcommand_from info upgrade shell" -l download-dir -d "Download directory" -r -a "(__fish_complete_directories)" |
0 commit comments