feat(shlvl): Add shlvl module (#1385)

* initial commit of support for shlvl

* documentation for shlvl

* use a symbol instead

* test coverage for shlvl

* actually disable when the config says to

* fix docs

* tweak defaults some

* refactor from pr comments

* redisable

* return early to avoid indenting

* make default suffix empty space

* fixing tests after suffix change

* updating docs for format

* making shlvl compatible with formatting

* adding variables table for shlvl

* removing extra line

* doc clarity
This commit is contained in:
Daniel A. White
2020-08-05 12:30:01 -04:00
committed by GitHub
parent c07b798046
commit 0be9ffc0a1
9 changed files with 280 additions and 0 deletions
+37
View File
@@ -178,6 +178,7 @@ format = """
$username\
$hostname\
$shlvl\
$kubernetes\
$directory\
$git_branch\
@@ -1985,6 +1986,42 @@ The module will be shown if any of the following conditions are met:
format = "via [⚙️ $version](red bold)"
```
## SHLVL
The `shlvl` module shows the current SHLVL ("shell level") environment variable, if it is
set to a number and meets or exceeds the specified threshold.
### Options
| Variable | Default | Description |
| ----------- | ---------------------------- | ------------------------------------------------ |
| `threshold` | `2` | Display threshold. |
| `format` | `"[$symbol$shlvl]($style) "` | The format for the module. |
| `symbol` | `"↕️ "` | The symbol used to represent the SHLVL. |
| `style` | `"bold yellow"` | The style for the module. |
| `disabled` | `true` | Disables the `shlvl` module. |
### Variables
| Variable | Example | Description |
| -------- | --------- | ------------------------------------ |
| shlvl | `3` | The current value of SHLVL |
| 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
[shlvl]
disabled = false
format = "$shlvl level(s) down"
threshold = 3
```
## Singularity
The `singularity` module shows the current singularity image, if inside a container