mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-25 23:30:08 +00:00
Plugins: Terraform (#6373)
Expanded Terraform plugin with function that can be used to show workspace name in the zsh prompt
This commit is contained in:
parent
46062e25cc
commit
d12c2ea4e8
2 changed files with 17 additions and 0 deletions
|
@ -9,3 +9,13 @@ Plugin for Terraform, a tool from Hashicorp for managing infrastructure safely a
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
* Type `terraform` into your prompt and hit `TAB` to see available completion options
|
* 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)\
|
||||||
|
```
|
||||||
|
|
7
plugins/terraform/terraform.plugin.zsh
Normal file
7
plugins/terraform/terraform.plugin.zsh
Normal file
|
@ -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
|
||||||
|
}
|
Loading…
Reference in a new issue