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