1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-11-24 21:57:41 +00:00

feat(shell): add unknown_indicator parameter (#2649)

* Add default config parameter for shell

* Update docs for shell default parameter

* Change parameter to more obvious name
This commit is contained in:
Rashil Gandhi 2021-05-01 00:18:05 +05:30 committed by GitHub
parent ff3c893a76
commit 1979331d47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 12 deletions

View File

@ -2442,7 +2442,7 @@ To enable it, set `disabled` to `false` in your configuration file.
### Options ### Options
| Option | Default | Description | | Option | Default | Description |
| ---------------------- | ------------- | --------------------------------------------- | | ---------------------- | ------------- | ------------------------------------------------------------ |
| `bash_indicator` | `bsh` | A format string used to represent bash. | | `bash_indicator` | `bsh` | A format string used to represent bash. |
| `fish_indicator` | `fsh` | A format string used to represent fish. | | `fish_indicator` | `fsh` | A format string used to represent fish. |
| `zsh_indicator` | `zsh` | A format string used to represent zsh. | | `zsh_indicator` | `zsh` | A format string used to represent zsh. |
@ -2450,6 +2450,7 @@ To enable it, set `disabled` to `false` in your configuration file.
| `ion_indicator` | `ion` | A format string used to represent ion. | | `ion_indicator` | `ion` | A format string used to represent ion. |
| `elvish_indicator` | `esh` | A format string used to represent elvish. | | `elvish_indicator` | `esh` | A format string used to represent elvish. |
| `tcsh_indicator` | `tsh` | A format string used to represent tcsh. | | `tcsh_indicator` | `tsh` | A format string used to represent tcsh. |
| `unknown_indicator` | | The default value to be displayed when the shell is unknown. |
| `format` | `$indicator ` | The format for the module. | | `format` | `$indicator ` | The format for the module. |
| `disabled` | `true` | Disables the `shell` module. | | `disabled` | `true` | Disables the `shell` module. |
@ -2467,6 +2468,7 @@ To enable it, set `disabled` to `false` in your configuration file.
[shell] [shell]
fish_indicator = "" fish_indicator = ""
powershell_indicator = "_" powershell_indicator = "_"
unknown_indicator = "mystery shell"
disabled = false disabled = false
``` ```

View File

@ -13,6 +13,7 @@ pub struct ShellConfig<'a> {
pub ion_indicator: &'a str, pub ion_indicator: &'a str,
pub elvish_indicator: &'a str, pub elvish_indicator: &'a str,
pub tcsh_indicator: &'a str, pub tcsh_indicator: &'a str,
pub unknown_indicator: &'a str,
pub disabled: bool, pub disabled: bool,
} }
@ -27,6 +28,7 @@ impl<'a> Default for ShellConfig<'a> {
ion_indicator: "ion", ion_indicator: "ion",
elvish_indicator: "esh", elvish_indicator: "esh",
tcsh_indicator: "tsh", tcsh_indicator: "tsh",
unknown_indicator: "",
disabled: true, disabled: true,
} }
} }

View File

@ -24,7 +24,7 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
Shell::Ion => Some(config.ion_indicator), Shell::Ion => Some(config.ion_indicator),
Shell::Elvish => Some(config.elvish_indicator), Shell::Elvish => Some(config.elvish_indicator),
Shell::Tcsh => Some(config.tcsh_indicator), Shell::Tcsh => Some(config.tcsh_indicator),
Shell::Unknown => None, Shell::Unknown => Some(config.unknown_indicator),
}, },
_ => None, _ => None,
}) })
@ -36,6 +36,7 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
"ion_indicator" => Some(Ok(config.ion_indicator)), "ion_indicator" => Some(Ok(config.ion_indicator)),
"elvish_indicator" => Some(Ok(config.elvish_indicator)), "elvish_indicator" => Some(Ok(config.elvish_indicator)),
"tcsh_indicator" => Some(Ok(config.tcsh_indicator)), "tcsh_indicator" => Some(Ok(config.tcsh_indicator)),
"unknown_indicator" => Some(Ok(config.unknown_indicator)),
_ => None, _ => None,
}) })
.parse(None) .parse(None)