fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
f0a54510c
master
1# Returns 0 if the command has not had a subcommand yet 2# Does not currently account for -chdir 3function __fish_tofu_needs_command 4set -l cmd( commandline -xpc) 5 6if test ( count $cmd ) -eq 1 7return 0 8end 9 10return 1 11end 12 13function __fish_tofu_workspaces 14tofu workspace list| string replace -r"^[\s\*]*" "" 15end 16 17# general options 18complete -f -c tofu -n"not __fish_tofu_needs_command" -o version -d"Print version information" 19complete -f -c tofu -o help -d"Show help" 20 21### apply/destroy 22set -l apply apply destroy 23 24complete -f -c tofu -n __fish_tofu_needs_command -a apply -d"Build or change infrastructure" 25complete -f -c tofu -n __fish_tofu_needs_command -a destroy -d"Destroy infrastructure" 26complete -f -c tofu -n"__fish_seen_subcommand_from $apply " -o auto-approve -d"Skip interactive approval" 27complete -r -c tofu -n"__fish_seen_subcommand_from $apply " -o backup -d"Path to backup the existing state file" 28complete -f -c tofu -n"__fish_seen_subcommand_from $apply " -o compact-warnings -d"Show only error summaries" 29complete -f -c tofu -n"__fish_seen_subcommand_from $apply " -o lock=false -d"Don't hold a state lock" 30complete -f -c tofu -n"__fish_seen_subcommand_from $apply " -o lock-timeout -d"Duration to retry a state lock" 31complete -f -c tofu -n"__fish_seen_subcommand_from $apply " -o input=true -d"Ask for input for variables if not directly set" 32complete -f -c tofu -n"__fish_seen_subcommand_from $apply " -o no-color -d"If specified, output won't contain any color" 33complete -f -c tofu -n"__fish_seen_subcommand_from $apply " -o parallelism -d"Limit the number of concurrent operations" 34complete -r -c tofu -n"__fish_seen_subcommand_from $apply " -o state -d"Path to a OpenTofu state file" 35complete -r -c tofu -n"__fish_seen_subcommand_from $apply " -o state-out -d"Path to write state" 36 37### console 38complete -f -c tofu -n __fish_tofu_needs_command -a console -d"Interactive console for OpenTofu interpolations" 39complete -r -c tofu -n"__fish_seen_subcommand_from console" -o state -d"Path to a OpenTofu state file" 40complete -f -c tofu -n"__fish_seen_subcommand_from console" -o var -d"Set a variable in the OpenTofu configuration" 41complete -r -c tofu -n"__fish_seen_subcommand_from console" -o var-file -d"Set variables from a file" 42 43### fmt 44complete -f -c tofu -n __fish_tofu_needs_command -a fmt -d"Rewrite config files to canonical format" 45complete -f -c tofu -n"__fish_seen_subcommand_from fmt" -o list=false -d"Don't list files whose formatting differs" 46complete -f -c tofu -n"__fish_seen_subcommand_from fmt" -o write=false -d"Don't write to source files" 47complete -f -c tofu -n"__fish_seen_subcommand_from fmt" -o diff -d"Display diffs of formatting changes" 48complete -f -c tofu -n"__fish_seen_subcommand_from fmt" -o check -d"Check if the input is formatted" 49complete -f -c tofu -n"__fish_seen_subcommand_from fmt" -o no-color -d"If specified, output won't contain any color" 50complete -f -c tofu -n"__fish_seen_subcommand_from fmt" -o recursive -d"Also process files in subdirectories" 51 52### get 53complete -f -c tofu -n __fish_tofu_needs_command -a get -d"Download and install modules for the configuration" 54complete -f -c tofu -n"__fish_seen_subcommand_from get" -o update -d"Check modules for updates" 55complete -f -c tofu -n"__fish_seen_subcommand_from get" -o no-color -d"If specified, output won't contain any color" 56 57### graph 58complete -f -c tofu -n __fish_tofu_needs_command -a graph -d"Create a visual graph of OpenTofu resources" 59complete -f -c tofu -n"__fish_seen_subcommand_from graph" -o plan -d"Use specified plan file instead of current directory" 60complete -f -c tofu -n"__fish_seen_subcommand_from graph" -o draw-cycles -d"Highlight any cycles in the graph" 61complete -f -c tofu -n"__fish_seen_subcommand_from graph" -o type=plan -d"Output plan graph" 62complete -f -c tofu -n"__fish_seen_subcommand_from graph" -o type=plan-refresh-only -d"Output plan graph assuming refresh only" 63complete -f -c tofu -n"__fish_seen_subcommand_from graph" -o type=plan-destroy -d"Output plan graph assuming destroy" 64complete -f -c tofu -n"__fish_seen_subcommand_from graph" -o type=apply -d"Output apply graph" 65complete -f -c tofu -n"__fish_seen_subcommand_from graph" -o consice -d"Shorten the plan output" 66 67### import 68complete -f -c tofu -n __fish_tofu_needs_command -a import -d"Import existing infrastructure into OpenTofu" 69complete -r -c tofu -n"__fish_seen_subcommand_from import" -o backup -d"Path to backup the existing state file" 70complete -f -c tofu -n"__fish_seen_subcommand_from import" -o config -d"Path to a directory of configuration files" 71complete -f -c tofu -n"__fish_seen_subcommand_from import" -o allow-missing-config -d"Allow import without resource block" 72complete -f -c tofu -n"__fish_seen_subcommand_from import" -o input=false -d"Disable interactive input prompts" 73complete -f -c tofu -n"__fish_seen_subcommand_from import" -o lock=false -d"Don't hold a state lock" 74complete -f -c tofu -n"__fish_seen_subcommand_from import" -o lock-timeout -d"Duration to retry a state lock" 75complete -f -c tofu -n"__fish_seen_subcommand_from import" -o no-color -d"If specified, output won't contain any color" 76complete -r -c tofu -n"__fish_seen_subcommand_from import" -o state -d"Path to a OpenTofu state file" 77complete -r -c tofu -n"__fish_seen_subcommand_from import" -o state-out -d"Path to write state" 78complete -f -c tofu -n"__fish_seen_subcommand_from import" -o var -d"Set a variable in the OpenTofu configuration" 79complete -r -c tofu -n"__fish_seen_subcommand_from import" -o var-file -d"Set variables from a file" 80 81### init 82complete -f -c tofu -n __fish_tofu_needs_command -a init -d"Initialize a new or existing OpenTofu configuration" 83complete -f -c tofu -n"__fish_seen_subcommand_from init" -o backend=false -d"Disable backend initialization" 84complete -f -c tofu -n"__fish_seen_subcommand_from init" -o cloud=false -d"Disable backend initialization" 85complete -r -c tofu -n"__fish_seen_subcommand_from init" -o backend-config -d"Backend configuration" 86complete -f -c tofu -n"__fish_seen_subcommand_from init" -o force-copy -d"Suppress prompts about copying state data" 87complete -f -c tofu -n"__fish_seen_subcommand_from init" -o from-module -d"Copy the module into target directory before init" 88complete -f -c tofu -n"__fish_seen_subcommand_from init" -o get=false -d"Disable downloading modules for this configuration" 89complete -f -c tofu -n"__fish_seen_subcommand_from init" -o input=false -d"Disable interactive prompts" 90complete -f -c tofu -n"__fish_seen_subcommand_from init" -o lock=false -d"Don't hold state lock" 91complete -f -c tofu -n"__fish_seen_subcommand_from init" -o lock-timeout -d"Duration to retry a state lock" 92complete -f -c tofu -n"__fish_seen_subcommand_from init" -o no-color -d"If specified, output won't contain any color" 93complete -f -c tofu -n"__fish_seen_subcommand_from init" -o plugin-dir -d"Directory containing plugin binaries" 94complete -f -c tofu -n"__fish_seen_subcommand_from init" -o reconfigure -d"Ignore any saved configuration" 95complete -r -c tofu -n"__fish_seen_subcommand_from init" -o migrate-state -d"Reconfigure backend, migrating existing state" 96complete -f -c tofu -n"__fish_seen_subcommand_from init" -o upgrade -d"Install latest dependencies, ignoring lockfile" 97complete -f -c tofu -n"__fish_seen_subcommand_from init" -o lockfile=readonly -d"Set dependency lockfile mode to readonly" 98complete -f -c tofu -n"__fish_seen_subcommand_from init" -o ignore-remote-version -d"Ignore local and remote backend compatibility check" 99complete -f -c tofu -n"__fish_seen_subcommand_from init" -o json -d"Print output in JSON" 100 101### login 102complete -f -c tofu -n __fish_tofu_needs_command -a login -d"Retrieves auth token for the given hostname" 103complete -f -c tofu -n"__fish_seen_subcommand_from login" -a"(__fish_print_hostnames)" 104 105### logout 106complete -f -c tofu -n __fish_tofu_needs_command -a logout -d"Removes auth token for the given hostname" 107complete -f -c tofu -n"__fish_seen_subcommand_from logout" -a"(__fish_print_hostnames)" 108 109### output 110complete -f -c tofu -n __fish_tofu_needs_command -a output -d"Read an output from a state file" 111complete -r -c tofu -n"__fish_seen_subcommand_from output" -o state -d"Path to the state file to read" 112complete -f -c tofu -n"__fish_seen_subcommand_from output" -o no-color -d"If specified, output won't contain any color" 113complete -f -c tofu -n"__fish_seen_subcommand_from output" -o json -d"Print output in JSON format" 114complete -f -c tofu -n"__fish_seen_subcommand_from output" -o raw -d"Print raw strings directly" 115 116### plan 117complete -f -c tofu -n __fish_tofu_needs_command -a plan -d"Generate and show an execution plan" 118complete -f -c tofu -n"__fish_seen_subcommand_from plan" -o compact-warnings -d"Show only error summaries" 119complete -f -c tofu -n"__fish_seen_subcommand_from plan" -o detailed-exitcode -d"Return detailed exit codes" 120complete -f -c tofu -n"__fish_seen_subcommand_from plan" -o input=true -d"Ask for input for variables if not directly set" 121complete -f -c tofu -n"__fish_seen_subcommand_from plan" -o lock=false -d"Don't hold a state lock during the operation" 122complete -f -c tofu -n"__fish_seen_subcommand_from plan" -o lock-timeout -d"Duration to retry a state lock" 123complete -f -c tofu -n"__fish_seen_subcommand_from plan" -o no-color -d"If specified, output won't contain any color" 124complete -f -c tofu -n"__fish_seen_subcommand_from plan" -o out -d"Write a plan file to the given path" 125complete -f -c tofu -n"__fish_seen_subcommand_from plan" -o parallelism -d"Limit the number of concurrent operations" 126complete -r -c tofu -n"__fish_seen_subcommand_from plan" -o state -d"Path to a OpenTofu state file" 127 128### plan customization options are reusable across apply, destroy, and plan 129set -l plan apply destroy plan 130 131complete -f -c tofu -n"__fish_seen_subcommand_from $plan " -o destroy -d"Select \"destroy\" planning mode" 132complete -f -c tofu -n"__fish_seen_subcommand_from $plan " -o refresh-only -d"Select \"refresh only\" planning mode" 133complete -f -c tofu -n"__fish_seen_subcommand_from $plan " -o refresh=false -d"Skip checking for external changes" 134complete -f -c tofu -n"__fish_seen_subcommand_from $plan " -o replace -d"Force replacement of resource using its address" 135complete -f -c tofu -n"__fish_seen_subcommand_from $plan " -o target -d"Resource to target" 136complete -f -c tofu -n"__fish_seen_subcommand_from $plan " -o exclude -d"Resource to ignore during plan" 137complete -f -c tofu -n"__fish_seen_subcommand_from $plan " -o var -d"Set a variable in the OpenTofu configuration" 138complete -r -c tofu -n"__fish_seen_subcommand_from $plan " -o var-file -d"Set variables from a file" 139 140### providers 141complete -f -c tofu -n __fish_tofu_needs_command -a providers -d"Print tree of modules with their provider requirements" 142complete -f -c tofu -n"__fish_seen_subcommand_from providers" -a"lock mirror schema" 143 144### refresh 145complete -f -c tofu -n __fish_tofu_needs_command -a refresh -d"Update local state file against real resources" 146complete -f -c tofu -n"__fish_seen_subcommand_from $apply " -o compact-warnings -d"Show only error summaries" 147complete -r -c tofu -n"__fish_seen_subcommand_from refresh" -o backup -d"Path to backup the existing state file" 148complete -f -c tofu -n"__fish_seen_subcommand_from refresh" -o input=true -d"Ask for input for variables if not directly set" 149complete -f -c tofu -n"__fish_seen_subcommand_from refresh" -o lock=false -d"Don't hold a state lock" 150complete -f -c tofu -n"__fish_seen_subcommand_from refresh" -o lock-timeout -d"Duration to retry a state lock" 151complete -f -c tofu -n"__fish_seen_subcommand_from refresh" -o no-color -d"If specified, output won't contain any color" 152complete -r -c tofu -n"__fish_seen_subcommand_from refresh" -o state -d"Path to a OpenTofu state file" 153complete -r -c tofu -n"__fish_seen_subcommand_from refresh" -o state-out -d"Path to write state" 154complete -f -c tofu -n"__fish_seen_subcommand_from refresh" -o target -d"Resource to target" 155complete -f -c tofu -n"__fish_seen_subcommand_from refresh" -o var -d"Set a variable in the OpenTofu configuration" 156complete -r -c tofu -n"__fish_seen_subcommand_from refresh" -o var-file -d"Set variables from a file" 157 158### show 159complete -f -c tofu -n __fish_tofu_needs_command -a show -d"Inspect OpenTofu state or plan" 160complete -f -c tofu -n"__fish_seen_subcommand_from show" -o no-color -d"If specified, output won't contain any color" 161complete -f -c tofu -n"__fish_seen_subcommand_from validate" -o json -d"Produce output in JSON format" 162 163### state 164complete -r -c tofu -n __fish_tofu_needs_command -a state -d"Advanced state management" 165complete -f -c tofu -n"__fish_seen_subcommand_from state" -a list -d"List resources in state" 166complete -f -c tofu -n"__fish_seen_subcommand_from state" -a ls -d"List resources in state" 167complete -f -c tofu -n"__fish_seen_subcommand_from state" -a mv -d"Move an item in the state" 168complete -f -c tofu -n"__fish_seen_subcommand_from state" -a move -d"Move an item in the state" 169complete -f -c tofu -n"__fish_seen_subcommand_from state" -a pull -d"Pull current state and output to stdout" 170complete -f -c tofu -n"__fish_seen_subcommand_from state" -a push -d"Update remote state from local state" 171complete -f -c tofu -n"__fish_seen_subcommand_from state" -a replace-provider -d"Replace provider in the state" 172complete -f -c tofu -n"__fish_seen_subcommand_from state" -a rm -d"Remove instance from the state" 173complete -f -c tofu -n"__fish_seen_subcommand_from state" -a remove -d"Remove instance from the state" 174complete -f -c tofu -n"__fish_seen_subcommand_from state" -a show -d"Show a resource in the state" 175 176### taint 177complete -f -c tofu -n __fish_tofu_needs_command -a taint -d"Manually mark a resource for recreation" 178complete -f -c tofu -n"__fish_seen_subcommand_from taint" -o allow-missing -d"Succeed even if resource is missing" 179complete -r -c tofu -n"__fish_seen_subcommand_from taint" -o backup -d"Path to backup the existing state file" 180complete -f -c tofu -n"__fish_seen_subcommand_from taint" -o lock=false -d"Don't hold a state lock" 181complete -f -c tofu -n"__fish_seen_subcommand_from taint" -o lock-timeout -d"Duration to retry a state lock" 182complete -f -c tofu -n"__fish_seen_subcommand_from taint" -o ignore-remote-version -d"Ignore local and remote backend compatibility check" 183complete -r -c tofu -n"__fish_seen_subcommand_from taint" -o state -d"Path to a OpenTofu state file" 184complete -r -c tofu -n"__fish_seen_subcommand_from taint" -o state-out -d"Path to write state" 185 186### test 187complete -f -c tofu -n __fish_tofu_needs_command -a test -d"Runs automated test of shared modules" 188complete -f -c tofu -n"__fish_seen_subcommand_from test" -o compact-warnings -d"Show only error summaries" 189complete -f -c tofu -n"__fish_seen_subcommand_from test" -o junit-xml -d"Also write test results to provided JUnit XML file" 190complete -f -c tofu -n"__fish_seen_subcommand_from test" -o no-color -d"If specified, output won't contain any color" 191 192### untaint 193complete -f -c tofu -n __fish_tofu_needs_command -a untaint -d"Manually unmark a resource as tainted" 194complete -f -c tofu -n"__fish_seen_subcommand_from untaint" -o allow-missing -d"Succeed even if resource is missing" 195complete -r -c tofu -n"__fish_seen_subcommand_from untaint" -o backup -d"Path to backup the existing state file" 196complete -f -c tofu -n"__fish_seen_subcommand_from untaint" -o lock=false -d"Don't hold a state lock" 197complete -f -c tofu -n"__fish_seen_subcommand_from untaint" -o lock-timeout -d"Duration to retry a state lock" 198complete -f -c tofu -n"__fish_seen_subcommand_from untaint" -o ignore-remote-version -d"Ignore local and remote backend compatibility check" 199complete -r -c tofu -n"__fish_seen_subcommand_from untaint" -o state -d"Path to a OpenTofu state file" 200complete -r -c tofu -n"__fish_seen_subcommand_from untaint" -o state-out -d"Path to write state" 201 202### validate 203complete -f -c tofu -n __fish_tofu_needs_command -a validate -d"Validate the OpenTofu files" 204complete -f -c tofu -n"__fish_seen_subcommand_from validate" -o json -d"Produce output in JSON format" 205complete -f -c tofu -n"__fish_seen_subcommand_from validate" -o no-color -d"If specified, output won't contain any color" 206 207### version 208complete -f -c tofu -n __fish_tofu_needs_command -a version -d"Print the OpenTofu version" 209 210### workspace 211set -l workspace_commands list select new delete 212 213complete -f -c tofu -n __fish_tofu_needs_command -a workspace -d"Workspace management" 214complete -f -c tofu -n"__fish_seen_subcommand_from workspace && not __fish_seen_subcommand_from $workspace_commands " -a list -d"List workspaces" 215complete -f -c tofu -n"__fish_seen_subcommand_from workspace && not __fish_seen_subcommand_from $workspace_commands " -a select -d"Select an workspace" 216complete -f -c tofu -n"__fish_seen_subcommand_from workspace && not __fish_seen_subcommand_from $workspace_commands " -a new -d"Create a new workspace" 217complete -f -c tofu -n"__fish_seen_subcommand_from workspace && not __fish_seen_subcommand_from $workspace_commands " -a delete -d"Delete an existing workspace" 218complete -f -c tofu -n"__fish_seen_subcommand_from workspace && __fish_seen_subcommand_from select delete" -a"(__fish_tofu_workspaces)"