feat(status): Convert known status code to their meaning (#1948)

User is able to choose if their want to display the meaning of known status code in place of number.
This commit is contained in:
Hugues Morisset
2021-01-03 04:09:13 +01:00
committed by GitHub
parent a07e184c45
commit cfff77043e
3 changed files with 275 additions and 14 deletions
+25 -13
View File
@@ -2262,20 +2262,31 @@ To enable it, set `disabled` to `false` in your configuration file.
### Options
| Option | Default | Description |
| ---------- | --------------------------- | ------------------------------------------------------ |
| `format` | `[$symbol$status]($style) ` | The format of the module |
| `symbol` | `"✖"` | A format string representing the symbol for the status |
| `style` | `"bold red"` | The style for the module. |
| `disabled` | `true` | Disables the `status` module. |
| Option | Default | Description |
| ------------------------- | --------------------------- | ------------------------------------------------------ |
| `format` | `[$symbol$status]($style) ` | The format of the module |
| `symbol` | `"✖"` | The symbol displayed on program error |
| `not_executable_symbol` | `"🚫"` | The symbol displayed when file isn't executable |
| `not_found_symbol` | `"🔍"` | The symbol displayed when the command can't be found |
| `sigint_symbol` | `"🧱"` | The symbol displayed on SIGINT (Ctrl + c) |
| `signal_symbol` | `"⚡"` | The symbol displayed on any signal |
| `style` | `"bold red"` | The style for the module. |
| `recognize_signal_code` | `true` | Enable signal mapping from exit code |
| `map_symbol` | `false` | Enable symbols mapping from exit code |
| `disabled` | `true` | Disables the `status` module. |
### Variables
| Variable | Example | Description |
| -------- | ------- | ------------------------------------ |
| status | `127` | The exit code of the last command |
| symbol | | Mirrors the value of option `symbol` |
| style\* | | Mirrors the value of option `style` |
| Variable | Example | Description |
| ----------------------- | ------- | ----------------------------------------------------------------------- |
| status | `127` | The exit code of the last command |
| int | `127` | The exit code of the last command |
| common_meaning | `ERROR` | Meaning of the code if not a signal |
| signal_number | `9` | Signal number corresponding to the exit code, only if signalled |
| signal_name | `KILL` | Name of the signal corresponding to the exit code, only if signalled |
| maybe_int | `7` | Contains the exit code number when no meaning has been found |
| 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
@@ -2287,8 +2298,9 @@ To enable it, set `disabled` to `false` in your configuration file.
[status]
style = "bg:blue"
symbol = "💣 "
format = '[\[$symbol$status\]]($style) '
symbol = "🔴"
format = '[\[$symbol $status_common_meaning$status_signal_name$status_maybe_int\]]($style) '
map_symbol = true
disabled = false
```