feat: Open Policy Agent module (#1740) (#4441)

* feat: Open Policy Agent module (#1740)

* Format documentation

* Fix typo, `ropa` -> `rego`

Co-authored-by: David Knaack <davidkna@users.noreply.github.com>

* Update presets for OPA module

* Add extra space to OPA module symbol

Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
This commit is contained in:
AppleTheGolden
2022-10-15 18:15:33 +02:00
committed by GitHub
parent 186d99e623
commit 865e68da3a
12 changed files with 278 additions and 0 deletions

View File

@@ -100,6 +100,9 @@ format = '\[[$symbol($version)]($style)\]'
[ocaml]
format = '\[[$symbol($version)(\($switch_indicator$switch_name\))]($style)\]'
[opa]
format = '\[[$symbol($version)]($style)\]'
[openstack]
format = '\[[$symbol$cloud(\($project\))]($style)\]'

View File

@@ -61,6 +61,9 @@ format = 'via [$symbol]($style)'
[ocaml]
format = 'via [$symbol(\($switch_indicator$switch_name\) )]($style)'
[opa]
format = 'via [$symbol]($style)'
[perl]
format = 'via [$symbol]($style)'

View File

@@ -97,6 +97,9 @@ symbol = "nix "
[ocaml]
symbol = "ml "
[opa]
symbol = "opa "
[package]
symbol = "pkg "

View File

@@ -259,6 +259,7 @@ $lua\
$nim\
$nodejs\
$ocaml\
$opa\
$perl\
$php\
$pulumi\
@@ -2635,6 +2636,43 @@ By default the module will be shown if any of the following conditions are met:
format = "via [🐪 $version]($style) "
```
## Open Policy Agent
The `opa` module shows the currently installed version of the OPA tool.
By default the module will be shown if the current directory contains a `.rego` file.
### Options
| Option | Default | Description |
| ------------------- | ------------------------------------ | ------------------------------------------------------------------------- |
| `format` | `"via [$symbol($version )]($style)"` | The format for the module. |
| `version_format` | `"v${raw}"` | The version format. Available vars are `raw`, `major`, `minor`, & `patch` |
| `symbol` | `"🪖 "` | A format string representing the symbol of OPA. |
| `detect_extensions` | `["rego"]` | Which extensions should trigger this module. |
| `detect_files` | `[]` | Which filenames should trigger this module. |
| `detect_folders` | `[]` | Which folders should trigger this module. |
| `style` | `"bold blue"` | The style for the module. |
| `disabled` | `false` | Disables the `opa` module. |
### Variables
| Variable | Example | Description |
| -------- | --------- | ------------------------------------ |
| version | `v0.44.0` | The version of `opa` |
| symbol | | Mirrors the value of option `symbol` |
| style\* | | Mirrors the value of option `style` |
*: This variable can only be used as a part of a style string
### Example
```toml
# ~/.config/starship.toml
[opa]
format = "via [⛑️ $version](bold red) "
```
## OpenStack
The `openstack` module shows the current OpenStack cloud and project. The module