diff options
author | Tuowen Zhao <ztuowen@gmail.com> | 2017-11-12 19:36:24 -0700 |
---|---|---|
committer | Tuowen Zhao <ztuowen@gmail.com> | 2017-11-12 19:36:24 -0700 |
commit | 5e1ad5efbf59a40ef6dc6d404c6f403dff8ed436 (patch) | |
tree | 2c9ab05f372ad5da84662e18a4d7e258b75d3b17 /plugins/terraform | |
parent | 6bcf7764f8d8094695c7c04bb9532a0ede40ab37 (diff) | |
parent | 41eedd37005f6b3668fcebe2a5f5a26324753519 (diff) | |
download | zsh-5e1ad5efbf59a40ef6dc6d404c6f403dff8ed436.tar.gz zsh-5e1ad5efbf59a40ef6dc6d404c6f403dff8ed436.tar.bz2 zsh-5e1ad5efbf59a40ef6dc6d404c6f403dff8ed436.zip |
Merge branch 'master' of https://github.com/robbyrussell/oh-my-zsh
Diffstat (limited to 'plugins/terraform')
-rw-r--r-- | plugins/terraform/README.md | 10 | ||||
-rw-r--r-- | plugins/terraform/_terraform | 1 | ||||
-rw-r--r-- | plugins/terraform/terraform.plugin.zsh | 7 |
3 files changed, 18 insertions, 0 deletions
diff --git a/plugins/terraform/README.md b/plugins/terraform/README.md index 44e38a1c0..b39f9916b 100644 --- a/plugins/terraform/README.md +++ b/plugins/terraform/README.md @@ -9,3 +9,13 @@ Plugin for Terraform, a tool from Hashicorp for managing infrastructure safely a ### Usage * Type `terraform` into your prompt and hit `TAB` to see available completion options + +### Expanding ZSH prompt with current Terraform workspace name + +If you want to get current Terraform workspace name in your ZSH prompt open +your .zsh-theme file and in a choosen place insert: + +``` +$FG[045]\ +$(terraform_prompt_info)\ +``` diff --git a/plugins/terraform/_terraform b/plugins/terraform/_terraform index 97c42a559..d67820603 100644 --- a/plugins/terraform/_terraform +++ b/plugins/terraform/_terraform @@ -62,6 +62,7 @@ __init() { '-address=[(url) URL of the remote storage server. Required for HTTP backend, optional for Atlas and Consul.]' \ '-access-token=[(token) Authentication token for state storage server. Required for Atlas backend, optional for Consul.]' \ '-backend=[(atlas) Specifies the type of remote backend. Must be one of Atlas, Consul, or HTTP. Defaults to atlas.]' \ + '-backend-config=[(path) Specifies the path to remote backend config file.]' \ '-name=[(name) Name of the state file in the state storage server. Required for Atlas backend.]' \ '-path=[(path) Path of the remote state in Consul. Required for the Consul backend.]' } diff --git a/plugins/terraform/terraform.plugin.zsh b/plugins/terraform/terraform.plugin.zsh new file mode 100644 index 000000000..84eec5cc1 --- /dev/null +++ b/plugins/terraform/terraform.plugin.zsh @@ -0,0 +1,7 @@ +function terraform_prompt_info() { + # check if in terraform dir + if [ -d .terraform ]; then + workspace=$(terraform workspace show 2> /dev/null) || return + echo "[${workspace}]" + fi +} |