fcbfdf42de702d55174fe2b19142ba232289671e

Author
Marcos Alano <marcoshalano@gmail.com>
Committer
Carlo Sala <carlosalag@protonmail.com>
Date

Message

feat(terraform): load completion from bash

Closes #11328
Closes #11330

Diff

This diff is truncated to protect this page.

 1diff --git a/plugins/terraform/_terraform b/plugins/terraform/_terraform
 2deleted file mode 100644
 3index 6258345635a22bb069efbfaae610608aa8580c1d..0000000000000000000000000000000000000000
 4--- a/plugins/terraform/_terraform
 5+++ /dev/null
 6@@ -1,411 +0,0 @@
 7-#compdef terraform
 8-
 9-local -a _terraform_cmds opt_args
10-_terraform_cmds=(
11-    'apply:Builds or changes infrastructure'
12-    'console:Interactive console for Terraform interpolations'
13-    'destroy:Destroy Terraform-managed infrastructure'
14-    'fmt:Rewrites config files to canonical format'
15-    'force-unlock:Manually unlock the terraform state'
16-    'get:Download and install modules for the configuration'
17-    'graph:Create a visual graph of Terraform resources'
18-    'import:Import existing infrastructure into Terraform'
19-    'init:Initialize a Terraform working directory'
20-    'login:Obtain and save credentials for a remote host'
21-    'logout:Remove locally-stored credentials for a remote host'
22-    'output:Read an output from a state file'
23-    'plan:Generate and show an execution plan'
24-    'providers:Prints a tree of the providers used in the configuration'
25-    'refresh:Update local state file against real resources'
26-    'show:Inspect Terraform state or plan'
27-    'state:Advanced state management'
28-    'taint:Manually mark a resource for recreation'
29-    'untaint:Manually unmark a resource as tainted'
30-    'validate:Validates the Terraform files'
31-    'version:Prints the Terraform version'
32-    'workspace:Workspace management'
33-    '0.12upgrade:Rewrites pre-0.12 module source code for v0.12'
34-    '0.13upgrade:Rewrites pre-0.13 module source code for v0.13'
35-)
36-
37-__012upgrade() {
38-  _arguments \
39-    '-yes[Skip the initial introduction messages and interactive confirmation. This can be used to run this command in batch from a script.]' \
40diff --git a/plugins/terraform/terraform.plugin.zsh b/plugins/terraform/terraform.plugin.zsh
41index d9e39e6ac22a28824ce0bbeab8408741cbad7363..eaa1e2e812effb50cfd7a2c01cea4164f227414c 100644
42--- a/plugins/terraform/terraform.plugin.zsh
43+++ b/plugins/terraform/terraform.plugin.zsh
44@@ -16,3 +16,8 @@ alias tfi='terraform init'
45 alias tfo='terraform output'
46 alias tfp='terraform plan'
47 alias tfv='terraform validate'
48+
49+if (( $+commands[terraform] )); then
50+  autoload -U +X bashcompinit && bashcompinit
51+  complete -o nospace -C terraform terraform
52+fi