feat(hostname): add option to replace hostnames with aliases (#6097)

---------

Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
This commit is contained in:
Eduard Korchmar
2024-08-12 18:26:35 +02:00
committed by GitHub
parent 7b65ad5163
commit 68a8fc9563
4 changed files with 81 additions and 2 deletions
+10 -1
View File
@@ -2355,6 +2355,7 @@ The `hostname` module shows the system hostname.
| `format` | `'[$ssh_symbol$hostname]($style) in '` | The format for the module. |
| `style` | `'bold dimmed green'` | The style for the module. |
| `disabled` | `false` | Disables the `hostname` module. |
| `aliases` | `{}` | Translate system hostnames to something else. If `trim_at` is specified, only the first part will be matched and replaced. |
### Variables
@@ -2391,6 +2392,14 @@ detect_env_vars = ['!TMUX', 'SSH_CONNECTION']
disabled = false
```
#### Replace the hostname with a nickname
```toml
# ~/.config/starship.toml
[hostname]
aliases = { "Max's MacBook Pro" = "home" }
```
## Java
The `java` module shows the currently installed version of [Java](https://www.oracle.com/java/).
@@ -4539,7 +4548,7 @@ these variables, one workaround is to set one of them with a dummy value.
| `format` | `'[$user]($style) in '` | The format for the module. |
| `show_always` | `false` | Always shows the `username` module. |
| `disabled` | `false` | Disables the `username` module. |
| `aliases` | `{}` | Translate system usernames to something else |
| `aliases` | `{}` | Translate system usernames to something else. |
### Variables