summaryrefslogtreecommitdiff
path: root/plugins/opentofu/README.md
diff options
context:
space:
mode:
authorchenzj <tibazq@gmail.com>2024-07-14 01:31:32 +0800
committerGitHub <noreply@github.com>2024-07-13 19:31:32 +0200
commitfd8f72b27614d48ec06421fb80aff2eb10674a69 (patch)
treebdcf6957212499abab662b67db026e6e15a82d22 /plugins/opentofu/README.md
parent0b27b15d0b08645bd995e13b8d69fcbe2ef7e8eb (diff)
downloadzsh-fd8f72b27614d48ec06421fb80aff2eb10674a69.tar.gz
zsh-fd8f72b27614d48ec06421fb80aff2eb10674a69.tar.bz2
zsh-fd8f72b27614d48ec06421fb80aff2eb10674a69.zip
feat(opentofu): add plugin for OpenTofu (#12285)
- Adds aliases - Sets up autocompletion - Adds promp functions to show workspace and `tofu` version Co-authored-by: Marc Cornellà <marc@mcornella.com>
Diffstat (limited to 'plugins/opentofu/README.md')
-rw-r--r--plugins/opentofu/README.md58
1 files changed, 58 insertions, 0 deletions
diff --git a/plugins/opentofu/README.md b/plugins/opentofu/README.md
new file mode 100644
index 000000000..9c19501aa
--- /dev/null
+++ b/plugins/opentofu/README.md
@@ -0,0 +1,58 @@
+# OpenTofu plugin
+
+Plugin for OpenTofu, a fork of Terraform that is open-source, community-driven, and managed by the Linux Foundation. It adds
+completion for `tofu` command, as well as aliases and a prompt function.
+
+To use it, add `opentofu` to the plugins array of your `~/.zshrc` file:
+
+```shell
+plugins=(... opentofu)
+```
+
+## Requirements
+
+- [OpenTofu](https://opentofu.org/)
+
+## Aliases
+
+| Alias | Command |
+| ----- | --------------- |
+| `tt` | `tofu` |
+| `tta` | `tofu apply` |
+| `ttc` | `tofu console` |
+| `ttd` | `tofu destroy` |
+| `ttf` | `tofu fmt` |
+| `tti` | `tofu init` |
+| `tto` | `tofu output` |
+| `ttp` | `tofu plan` |
+| `ttv` | `tofu validate` |
+| `tts` | `tofu state` |
+| `ttsh`| `tofu show` |
+| `ttr` | `tofu refresh` |
+| `ttt` | `tofu test` |
+| `ttws`| `tofu workspace`|
+
+
+## Prompt functions
+
+- `tofu_prompt_info`: shows the current workspace when in an OpenTofu project directory.
+
+- `tofu_version_prompt_info`: shows the current version of the `tofu` commmand.
+
+To use them, add them to a `PROMPT` variable in your theme or `.zshrc` file:
+
+```sh
+PROMPT='$(tofu_prompt_info)'
+RPROMPT='$(tofu_version_prompt_info)'
+```
+
+You can also specify the PREFIX and SUFFIX strings for both functions, with the following variables:
+
+```sh
+# for tofu_prompt_info
+ZSH_THEME_TOFU_PROMPT_PREFIX="%{$fg[white]%}"
+ZSH_THEME_TOFU_PROMPT_SUFFIX="%{$reset_color%}"
+# for tofu_version_prompt_info
+ZSH_THEME_TOFU_VERSION_PROMPT_PREFIX="%{$fg[white]%}"
+ZSH_THEME_TOFU_VERSION_PROMPT_SUFFIX="%{$reset_color%}"
+```