Address review comments
* Add workspace completions * Fix missing file completions
This commit is contained in:
parent
3b2fb23bca
commit
2bf9b97ab7
@ -10,6 +10,10 @@ function __fish_terraform_needs_command
|
||||
return 1
|
||||
end
|
||||
|
||||
function __fish_terraform_workspaces
|
||||
terraform workspace list | string replace -r "^[\s\*]*" ""
|
||||
end
|
||||
|
||||
# general options
|
||||
complete -f -c terraform -n "not __fish_terraform_needs_command" -o version -d "Print version information"
|
||||
complete -f -c terraform -o help -d "Show help"
|
||||
@ -20,21 +24,21 @@ set -l apply apply destroy
|
||||
complete -f -c terraform -n __fish_terraform_needs_command -a apply -d "Build or change infrastructure"
|
||||
complete -f -c terraform -n __fish_terraform_needs_command -a destroy -d "Destroy infrastructure"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from $apply" -o auto-approve -d "Skip interactive approval"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from $apply" -o backup -d "Path to backup the existing state file"
|
||||
complete -r -c terraform -n "__fish_seen_subcommand_from $apply" -o backup -d "Path to backup the existing state file"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from $apply" -o compact-warnings -d "Show only error summaries"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from $apply" -o lock=false -d "Don't hold a state lock"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from $apply" -o lock-timeout -d "Duration to retry a state lock"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from $apply" -o input=true -d "Ask for input for variables if not directly set"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from $apply" -o no-color -d "If specified, output won't contain any color"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from $apply" -o parallelism -d "Limit the number of concurrent operations"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from $apply" -o state -d "Path to a Terraform state file"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from $apply" -o state-out -d "Path to write state"
|
||||
complete -r -c terraform -n "__fish_seen_subcommand_from $apply" -o state -d "Path to a Terraform state file"
|
||||
complete -r -c terraform -n "__fish_seen_subcommand_from $apply" -o state-out -d "Path to write state"
|
||||
|
||||
### console
|
||||
complete -f -c terraform -n __fish_terraform_needs_command -a console -d "Interactive console for Terraform interpolations"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from console" -o state -d "Path to a Terraform state file"
|
||||
complete -r -c terraform -n "__fish_seen_subcommand_from console" -o state -d "Path to a Terraform state file"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from console" -o var -d "Set a variable in the Terraform configuration"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from console" -o var-file -d "Set variables from a file"
|
||||
complete -r -c terraform -n "__fish_seen_subcommand_from console" -o var-file -d "Set variables from a file"
|
||||
|
||||
### fmt
|
||||
complete -f -c terraform -n __fish_terraform_needs_command -a fmt -d "Rewrite config files to canonical format"
|
||||
@ -61,17 +65,17 @@ complete -f -c terraform -n "__fish_seen_subcommand_from graph" -o type=apply -d
|
||||
|
||||
### import
|
||||
complete -f -c terraform -n __fish_terraform_needs_command -a import -d "Import existing infrastructure into Terraform"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from import" -o backup -d "Path to backup the existing state file"
|
||||
complete -r -c terraform -n "__fish_seen_subcommand_from import" -o backup -d "Path to backup the existing state file"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from import" -o config -d "Path to a directory of configuration files"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from import" -o allow-missing-config -d "Allow import without resource block"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from import" -o input=false -d "Disable interactive input prompts"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from import" -o lock=false -d "Don't hold a state lock"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from import" -o lock-timeout -d "Duration to retry a state lock"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from import" -o no-color -d "If specified, output won't contain any color"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from import" -o state -d "Path to a Terraform state file"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from import" -o state-out -d "Path to write state"
|
||||
complete -r -c terraform -n "__fish_seen_subcommand_from import" -o state -d "Path to a Terraform state file"
|
||||
complete -r -c terraform -n "__fish_seen_subcommand_from import" -o state-out -d "Path to write state"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from import" -o var -d "Set a variable in the Terraform configuration"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from import" -o var-file -d "Set variables from a file"
|
||||
complete -r -c terraform -n "__fish_seen_subcommand_from import" -o var-file -d "Set variables from a file"
|
||||
|
||||
### init
|
||||
complete -f -c terraform -n __fish_terraform_needs_command -a init -d "Initialize a new or existing Terraform configuration"
|
||||
@ -87,7 +91,7 @@ complete -f -c terraform -n "__fish_seen_subcommand_from init" -o lock-timeout -
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from init" -o no-color -d "If specified, output won't contain any color"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from init" -o plugin-dir -d "Directory containing plugin binaries"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from init" -o reconfigure -d "Ignore any saved configuration"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from init" -o migrate-state -d "Reconfigure backend, migrating existing state"
|
||||
complete -r -c terraform -n "__fish_seen_subcommand_from init" -o migrate-state -d "Reconfigure backend, migrating existing state"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from init" -o upgrade -d "Install latest dependencies, ignoring lockfile"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from init" -o lockfile=readonly -d "Set dependency lockfile mode to readonly"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from init" -o ignore-remote-version -d "Ignore local and remote backend compatibility check"
|
||||
@ -102,7 +106,7 @@ complete -f -c terraform -n "__fish_seen_subcommand_from logout" -a "(__fish_pri
|
||||
|
||||
### output
|
||||
complete -f -c terraform -n __fish_terraform_needs_command -a output -d "Read an output from a state file"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from output" -o state -d "Path to the state file to read"
|
||||
complete -r -c terraform -n "__fish_seen_subcommand_from output" -o state -d "Path to the state file to read"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from output" -o no-color -d "If specified, output won't contain any color"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from output" -o json -d "Print output in JSON format"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from output" -o raw -d "Print raw strings directly"
|
||||
@ -117,7 +121,7 @@ complete -f -c terraform -n "__fish_seen_subcommand_from plan" -o lock-timeout -
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from plan" -o no-color -d "If specified, output won't contain any color"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from plan" -o out -d "Write a plan file to the given path"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from plan" -o parallelism -d "Limit the number of concurrent operations"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from plan" -o state -d "Path to a Terraform state file"
|
||||
complete -r -c terraform -n "__fish_seen_subcommand_from plan" -o state -d "Path to a Terraform state file"
|
||||
|
||||
### plan customization options are reusable across apply, destroy, and plan
|
||||
set -l plan apply destroy plan
|
||||
@ -128,7 +132,7 @@ complete -f -c terraform -n "__fish_seen_subcommand_from $plan" -o refresh=false
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from $plan" -o replace -d "Force replacement of resource using its address"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from $plan" -o target -d "Resource to target"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from $plan" -o var -d "Set a variable in the Terraform configuration"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from $plan" -o var-file -d "Set variables from a file"
|
||||
complete -r -c terraform -n "__fish_seen_subcommand_from $plan" -o var-file -d "Set variables from a file"
|
||||
|
||||
### providers
|
||||
complete -f -c terraform -n __fish_terraform_needs_command -a providers -d "Print tree of modules with their provider requirements"
|
||||
@ -137,16 +141,16 @@ complete -f -c terraform -n "__fish_seen_subcommand_from providers" -a "lock mir
|
||||
### refresh
|
||||
complete -f -c terraform -n __fish_terraform_needs_command -a refresh -d "Update local state file against real resources"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from $apply" -o compact-warnings -d "Show only error summaries"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from refresh" -o backup -d "Path to backup the existing state file"
|
||||
complete -r -c terraform -n "__fish_seen_subcommand_from refresh" -o backup -d "Path to backup the existing state file"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from refresh" -o input=true -d "Ask for input for variables if not directly set"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from refresh" -o lock=false -d "Don't hold a state lock"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from refresh" -o lock-timeout -d "Duration to retry a state lock"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from refresh" -o no-color -d "If specified, output won't contain any color"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from refresh" -o state -d "Path to a Terraform state file"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from refresh" -o state-out -d "Path to write state"
|
||||
complete -r -c terraform -n "__fish_seen_subcommand_from refresh" -o state -d "Path to a Terraform state file"
|
||||
complete -r -c terraform -n "__fish_seen_subcommand_from refresh" -o state-out -d "Path to write state"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from refresh" -o target -d "Resource to target"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from refresh" -o var -d "Set a variable in the Terraform configuration"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from refresh" -o var-file -d "Set variables from a file"
|
||||
complete -r -c terraform -n "__fish_seen_subcommand_from refresh" -o var-file -d "Set variables from a file"
|
||||
|
||||
### show
|
||||
complete -f -c terraform -n __fish_terraform_needs_command -a show -d "Inspect Terraform state or plan"
|
||||
@ -154,7 +158,7 @@ complete -f -c terraform -n "__fish_seen_subcommand_from show" -o no-color -d "I
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from validate" -o json -d "Produce output in JSON format"
|
||||
|
||||
### state
|
||||
complete -f -c terraform -n __fish_terraform_needs_command -a state -d "Advanced state management"
|
||||
complete -r -c terraform -n __fish_terraform_needs_command -a state -d "Advanced state management"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from state" -a list -d "List resources in state"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from state" -a mv -d "Move an item in the state"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from state" -a pull -d "Pull current state and output to stdout"
|
||||
@ -166,12 +170,12 @@ complete -f -c terraform -n "__fish_seen_subcommand_from state" -a show -d "Show
|
||||
### taint
|
||||
complete -f -c terraform -n __fish_terraform_needs_command -a taint -d "Manually mark a resource for recreation"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from taint" -o allow-missing -d "Succeed even if resource is missing"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from taint" -o backup -d "Path to backup the existing state file"
|
||||
complete -r -c terraform -n "__fish_seen_subcommand_from taint" -o backup -d "Path to backup the existing state file"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from taint" -o lock=false -d "Don't hold a state lock"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from taint" -o lock-timeout -d "Duration to retry a state lock"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from taint" -o ignore-remote-version -d "Ignore local and remote backend compatibility check"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from taint" -o state -d "Path to a Terraform state file"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from taint" -o state-out -d "Path to write state"
|
||||
complete -r -c terraform -n "__fish_seen_subcommand_from taint" -o state -d "Path to a Terraform state file"
|
||||
complete -r -c terraform -n "__fish_seen_subcommand_from taint" -o state-out -d "Path to write state"
|
||||
|
||||
### test
|
||||
complete -f -c terraform -n __fish_terraform_needs_command -a test -d "Runs automated test of shared modules"
|
||||
@ -182,12 +186,12 @@ complete -f -c terraform -n "__fish_seen_subcommand_from test" -o no-color -d "I
|
||||
### untaint
|
||||
complete -f -c terraform -n __fish_terraform_needs_command -a untaint -d "Manually unmark a resource as tainted"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from untaint" -o allow-missing -d "Succeed even if resource is missing"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from untaint" -o backup -d "Path to backup the existing state file"
|
||||
complete -r -c terraform -n "__fish_seen_subcommand_from untaint" -o backup -d "Path to backup the existing state file"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from untaint" -o lock=false -d "Don't hold a state lock"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from untaint" -o lock-timeout -d "Duration to retry a state lock"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from untaint" -o ignore-remote-version -d "Ignore local and remote backend compatibility check"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from untaint" -o state -d "Path to a Terraform state file"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from untaint" -o state-out -d "Path to write state"
|
||||
complete -r -c terraform -n "__fish_seen_subcommand_from untaint" -o state -d "Path to a Terraform state file"
|
||||
complete -r -c terraform -n "__fish_seen_subcommand_from untaint" -o state-out -d "Path to write state"
|
||||
|
||||
### validate
|
||||
complete -f -c terraform -n __fish_terraform_needs_command -a validate -d "Validate the Terraform files"
|
||||
@ -198,8 +202,11 @@ complete -f -c terraform -n "__fish_seen_subcommand_from validate" -o no-color -
|
||||
complete -f -c terraform -n __fish_terraform_needs_command -a version -d "Print the Terraform version"
|
||||
|
||||
### workspace
|
||||
set -l workspace_commands list select new delete
|
||||
|
||||
complete -f -c terraform -n __fish_terraform_needs_command -a workspace -d "Workspace management"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from workspace" -a list -d "List workspaces"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from workspace" -a select -d "Select an workspace"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from workspace" -a new -d "Create a new workspace"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from workspace" -a delete -d "Delete an existing workspace"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from workspace && not __fish_seen_subcommand_from $workspace_commands" -a list -d "List workspaces"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from workspace && not __fish_seen_subcommand_from $workspace_commands" -a select -d "Select an workspace"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from workspace && not __fish_seen_subcommand_from $workspace_commands" -a new -d "Create a new workspace"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from workspace && not __fish_seen_subcommand_from $workspace_commands" -a delete -d "Delete an existing workspace"
|
||||
complete -f -c terraform -n "__fish_seen_subcommand_from workspace && __fish_seen_subcommand_from select delete" -a "(__fish_terraform_workspaces)"
|
||||
|
Loading…
x
Reference in New Issue
Block a user