feat(module): Add a meson devenv indicator (#4389)

* feat(module): Add a meson devenv indicator

Adds a Meson Developer Environment indicator, if the MESON_DEVENV
variable is set. Inside a `meson devenv`, the prompt will include the
current Meson project name

This also contains a new Truncate utility function, which may be adapted for other modules in the future

* docs: Add Meson to presets
This commit is contained in:
Jamie
2022-10-11 09:02:46 -07:00
committed by GitHub
parent 4107031331
commit 355800f814
14 changed files with 346 additions and 0 deletions
@@ -85,6 +85,9 @@ format = '\[[$symbol($version)]($style)\]'
[memory_usage]
format = '\[$symbol[$ram( | $swap)]($style)\]'
[meson]
format = '\[[$symbol$project]($style)\]'
[nim]
format = '\[[$symbol($version)]($style)\]'
@@ -49,6 +49,9 @@ symbol = " "
[memory_usage]
symbol = " "
[meson]
symbol = "喝 "
[nim]
symbol = " "
@@ -49,6 +49,9 @@ format = 'via [$symbol]($style)'
[lua]
format = 'via [$symbol]($style)'
[meson]
format = 'via [$symbol]($style)'
[nim]
format = 'via [$symbol]($style)'
@@ -85,6 +85,9 @@ symbol = "nodejs "
[memory_usage]
symbol = "memory "
[meson]
symbol = "meson "
[nim]
symbol = "nim "
+40
View File
@@ -278,6 +278,7 @@ $zig\
$buf\
$nix_shell\
$conda\
$meson\
$spack\
$memory_usage\
$aws\
@@ -2384,6 +2385,45 @@ symbol = " "
style = "bold dimmed green"
```
## Meson
The `meson` module shows the current Meson developer environment status.
By default the Meson project name is displayed, if `$MESON_DEVENV` is set.
### Options
| Option | Default | Description |
| ------------------- | ---------------------------------- | ----------------------------------------------------------------------------------------- |
| `truncation_length` | `2^32 - 1` | Truncates a project name to `N` graphemes. |
| `truncation_symbol` | `"…"` | The symbol used to indicate a project name was truncated. You can use `""` for no symbol. |
| `format` | `"via [$symbol$project]($style) "` | The format for the module. |
| `symbol` | `"⬢ "` | The symbol used before displaying the project name. |
| `style` | `"blue bold"` | The style for the module. |
| `disabled` | `false` | Disables the `meson` module. |
### Variables
| Variable | Example | Description |
| -------- | ---------- | ------------------------------------ |
| project | `starship` | The current Meson project name |
| 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
[meson]
disabled = false
truncation_symbol = "--"
symbol = " "
style = "bold dimmed green"
```
## Mercurial Branch
The `hg_branch` module shows the active branch of the repo in your current directory.