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

@ -2441,17 +2441,18 @@ To enable it, set `disabled` to `false` in your configuration file.
### Options
| Option | Default | Description |
| ---------------------- | ------------- | --------------------------------------------- |
| `bash_indicator` | `bsh` | A format string used to represent bash. |
| `fish_indicator` | `fsh` | A format string used to represent fish. |
| `zsh_indicator` | `zsh` | A format string used to represent zsh. |
| `powershell_indicator` | `psh` | A format string used to represent powershell. |
| `ion_indicator` | `ion` | A format string used to represent ion. |
| `elvish_indicator` | `esh` | A format string used to represent elvish. |
| `tcsh_indicator` | `tsh` | A format string used to represent tcsh. |
| `format` | `$indicator ` | The format for the module. |
| `disabled` | `true` | Disables the `shell` module. |
| Option | Default | Description |
| ---------------------- | ------------- | ------------------------------------------------------------ |
| `bash_indicator` | `bsh` | A format string used to represent bash. |
| `fish_indicator` | `fsh` | A format string used to represent fish. |
| `zsh_indicator` | `zsh` | A format string used to represent zsh. |
| `powershell_indicator` | `psh` | A format string used to represent powershell. |
| `ion_indicator` | `ion` | A format string used to represent ion. |
| `elvish_indicator` | `esh` | A format string used to represent elvish. |
| `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. |
| `disabled` | `true` | Disables the `shell` module. |
### Variables
@ -2467,6 +2468,7 @@ To enable it, set `disabled` to `false` in your configuration file.
[shell]
fish_indicator = ""
powershell_indicator = "_"
unknown_indicator = "mystery shell"
disabled = false
```

View File

@ -13,6 +13,7 @@ pub struct ShellConfig<'a> {
pub ion_indicator: &'a str,
pub elvish_indicator: &'a str,
pub tcsh_indicator: &'a str,
pub unknown_indicator: &'a str,
pub disabled: bool,
}
@ -27,6 +28,7 @@ impl<'a> Default for ShellConfig<'a> {
ion_indicator: "ion",
elvish_indicator: "esh",
tcsh_indicator: "tsh",
unknown_indicator: "",
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::Elvish => Some(config.elvish_indicator),
Shell::Tcsh => Some(config.tcsh_indicator),
Shell::Unknown => None,
Shell::Unknown => Some(config.unknown_indicator),
},
_ => None,
})
@ -36,6 +36,7 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
"ion_indicator" => Some(Ok(config.ion_indicator)),
"elvish_indicator" => Some(Ok(config.elvish_indicator)),
"tcsh_indicator" => Some(Ok(config.tcsh_indicator)),
"unknown_indicator" => Some(Ok(config.unknown_indicator)),
_ => None,
})
.parse(None)