summaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorDavid Knaack <davidkna@users.noreply.github.com>2022-04-09 17:32:45 +0200
committerGitHub <noreply@github.com>2022-04-09 11:32:45 -0400
commit28da85061bf9859d84ab5471017d4b80ee36dd35 (patch)
tree75669fef84ac7a5dd46089242bf80708d46dfe7c /docs
parente61394a97a47221b244cd5213a323ed0afccb962 (diff)
refactor(custom): various improvements (#3829)
Diffstat (limited to 'docs')
-rw-r--r--docs/config/README.md49
1 files changed, 30 insertions, 19 deletions
diff --git a/docs/config/README.md b/docs/config/README.md
index 0dec040be..977f60429 100644
--- a/docs/config/README.md
+++ b/docs/config/README.md
@@ -3666,9 +3666,9 @@ The `custom` modules show the output of some arbitrary commands.
These modules will be shown if any of the following conditions are met:
-- The current directory contains a file whose name is in `files`
-- The current directory contains a directory whose name is in `directories`
-- The current directory contains a file whose extension is in `extensions`
+- The current directory contains a file whose name is in `detect_files`
+- The current directory contains a directory whose name is in `detect_folders`
+- The current directory contains a file whose extension is in `detect_extensions`
- The `when` command returns 0
- The current Operating System (std::env::consts::OS) matchs with `os` field if defined.
@@ -3708,20 +3708,21 @@ Format strings can also contain shell specific prompt sequences, e.g.
### Options
-| Option | Default | Description |
-| ------------- | ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `command` | `""` | The command whose output should be printed. The command will be passed on stdin to the shell. |
-| `when` | | A shell command used as a condition to show the module. The module will be shown if the command returns a `0` status code. |
-| `shell` | | [See below](#custom-command-shell) |
-| `description` | `"<custom module>"` | The description of the module that is shown when running `starship explain`. |
-| `files` | `[]` | The files that will be searched in the working directory for a match. |
-| `directories` | `[]` | The directories that will be searched in the working directory for a match. |
-| `extensions` | `[]` | The extensions that will be searched in the working directory for a match. |
-| `symbol` | `""` | The symbol used before displaying the command output. |
-| `style` | `"bold green"` | The style for the module. |
-| `format` | `"[$symbol($output )]($style)"` | The format for the module. |
-| `disabled` | `false` | Disables this `custom` module. |
-| `os` | | Operating System name on which the module will be shown (unix, linux, macos, windows, ... ) [See possible values](https://doc.rust-lang.org/std/env/consts/constant.OS.html). |
+| Option | Default | Description |
+| ------------------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `command` | `""` | The command whose output should be printed. The command will be passed on stdin to the shell. |
+| `when` | `false` | Either a boolean value (`true` or `false`, without quotes) or a string shell command used as a condition to show the module. In case of a string, the module will be shown if the command returns a `0` status code. |
+| `shell` | | [See below](#custom-command-shell) |
+| `description` | `"<custom module>"` | The description of the module that is shown when running `starship explain`. |
+| `detect_files` | `[]` | The files that will be searched in the working directory for a match. |
+| `detect_folders` | `[]` | The directories that will be searched in the working directory for a match. |
+| `detect_extensions` | `[]` | The extensions that will be searched in the working directory for a match. |
+| `symbol` | `""` | The symbol used before displaying the command output. |
+| `style` | `"bold green"` | The style for the module. |
+| `format` | `"[$symbol($output )]($style)"` | The format for the module. |
+| `disabled` | `false` | Disables this `custom` module. |
+| `os` | | Operating System name on which the module will be shown (unix, linux, macos, windows, ... ) [See possible values](https://doc.rust-lang.org/std/env/consts/constant.OS.html). |
+| `use_stdin` | | An optional boolean value that overrides whether commands should be forwarded to the shell via the standard input or as an argument. If unset standard input is used by default, unless the shell does not support it (cmd, nushell). Setting this disables shell-specific argument handling. |
### Variables
@@ -3746,6 +3747,10 @@ The `command` will be passed in on stdin.
If `shell` is not given or only contains one element and Starship detects PowerShell will be used,
the following arguments will automatically be added: `-NoProfile -Command -`.
+If `shell` is not given or only contains one element and Starship detects Cmd will be used,
+the following argument will automatically be added: `/C` and `stdin` will be set to `false`.
+If `shell` is not given or only contains one element and Starship detects Nushell will be used,
+the following arguments will automatically be added: `-c` and `stdin` will be set to `false`.
This behavior can be avoided by explicitly passing arguments to the shell, e.g.
```toml
@@ -3782,12 +3787,18 @@ with shell details and starship configuration if you hit such scenario.
[custom.foo]
command = "echo foo" # shows output of command
-files = ["foo"] # can specify filters but wildcards are not supported
+detect_files = ["foo"] # can specify filters but wildcards are not supported
when = """ test "$HOME" == "$PWD" """
format = " transcending [$output]($style)"
[custom.time]
command = "time /T"
-extensions = ["pst"] # filters *.pst files
+detect_extensions = ["pst"] # filters *.pst files
shell = ["pwsh.exe", "-NoProfile", "-Command", "-"]
+
+[custom.time-as-arg]
+command = "time /T"
+detect_extensions = ["pst"] # filters *.pst files
+shell = ["pwsh.exe", "-NoProfile", "-Command"]
+use_stdin = false
```