summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRashil Gandhi <46838874+rashil2000@users.noreply.github.com>2021-05-01 00:18:05 +0530
committerGitHub <noreply@github.com>2021-04-30 20:48:05 +0200
commit1979331d47a5be91c7997c4e5a7fdf6c29ae6f49 (patch)
tree1cb4afda8f9f09a057ddb0d70464f7f080150e56
parentff3c893a76268efcd55e629cfa8e7587a9677067 (diff)
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
-rw-r--r--docs/config/README.md24
-rw-r--r--src/configs/shell.rs2
-rw-r--r--src/modules/shell.rs3
3 files changed, 17 insertions, 12 deletions
diff --git a/docs/config/README.md b/docs/config/README.md
index 3cad18597..788ae24d6 100644
--- a/docs/config/README.md
+++ b/docs/config/README.md
@@ -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
```
diff --git a/src/configs/shell.rs b/src/configs/shell.rs
index 445c1bb9e..6be8b13a1 100644
--- a/src/configs/shell.rs
+++ b/src/configs/shell.rs
@@ -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,
}
}
diff --git a/src/modules/shell.rs b/src/modules/shell.rs
index c8b6a2c92..02c9be410 100644
--- a/src/modules/shell.rs
+++ b/src/modules/shell.rs
@@ -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)