diff options
author | mehdicopter <mmahfoudi@meilleursagents.com> | 2021-06-19 00:17:40 +0200 |
---|---|---|
committer | Marc Cornellà <hello@mcornella.com> | 2021-12-29 16:16:20 +0100 |
commit | 659dbb53680c6f931d8e20d267fe879a37ba42f1 (patch) | |
tree | 0f64219e6a192ec2f5474a5f378255e344a4f6c2 /plugins/terraform | |
parent | 0e399d47b96b6007570cd21034e8a3d6144ad111 (diff) | |
download | zsh-659dbb53680c6f931d8e20d267fe879a37ba42f1.tar.gz zsh-659dbb53680c6f931d8e20d267fe879a37ba42f1.tar.bz2 zsh-659dbb53680c6f931d8e20d267fe879a37ba42f1.zip |
feat(terraform): add more aliases (#9989)
Closes #9989
Diffstat (limited to 'plugins/terraform')
-rw-r--r-- | plugins/terraform/README.md | 45 | ||||
-rw-r--r-- | plugins/terraform/terraform.plugin.zsh | 6 |
2 files changed, 35 insertions, 16 deletions
diff --git a/plugins/terraform/README.md b/plugins/terraform/README.md index 9e9f0cdfb..474346dc0 100644 --- a/plugins/terraform/README.md +++ b/plugins/terraform/README.md @@ -1,14 +1,7 @@ -## Terraform oh-my-zsh plugin +# Terraform plugin Plugin for Terraform, a tool from Hashicorp for managing infrastructure safely and efficiently. - -Current as of Terraform v0.13 - -### Requirements - - * [Terraform](https://terraform.io/) - -### Usage +It adds completion for `terraform`, as well as aliases and a prompt function. To use it, add `terraform` to the plugins array of your `~/.zshrc` file: @@ -16,14 +9,34 @@ To use it, add `terraform` to the plugins array of your `~/.zshrc` file: plugins=(... terraform) ``` - * Type `terraform` into your prompt and hit `TAB` to see available completion options - * Type `tf` into your prompt as a short alias to `terraform` +## Requirements -### Expanding ZSH prompt with current Terraform workspace name +* [Terraform](https://terraform.io/) -If you want to get current Terraform workspace name in your ZSH prompt open -your .zsh-theme file and in a chosen place insert: +## Aliases -```shell -PROMPT=$'%{$fg[white]%}$(tf_prompt_info)%{$reset_color%} ' +| Alias | Command | +| ----- | -------------------- | +| `tf` | `terraform` | +| `tfa` | `terraform apply` | +| `tfd` | `terraform destroy` | +| `tff` | `terraform fmt` | +| `tfi` | `terraform init` | +| `tfp` | `terraform plan` | +| `tfv` | `terraform validate` | + +## Prompt function + +You can add the current Terraform workspace in your prompt by adding `$(tf_prompt_info)` +to your `PROMPT` or `RPROMPT` variable. + +```sh +RPROMPT='$(tf_prompt_info)' +``` + +You can also specify the PREFIX and SUFFIX for the workspace with the following variables: + +```sh +ZSH_THEME_TF_PROMPT_PREFIX="%{$fg[white]%}" +ZSH_THEME_TF_PROMPT_SUFFIX="%{$reset_color%}" ``` diff --git a/plugins/terraform/terraform.plugin.zsh b/plugins/terraform/terraform.plugin.zsh index 86b12751c..f224b79f0 100644 --- a/plugins/terraform/terraform.plugin.zsh +++ b/plugins/terraform/terraform.plugin.zsh @@ -9,3 +9,9 @@ function tf_prompt_info() { } alias tf='terraform' +alias tfa='terraform apply' +alias tfd='terraform destroy' +alias tff='terraform fmt' +alias tfi='terraform init' +alias tfp='terraform plan' +alias tfv='terraform validate' |