docs: Improvements in docs for custom modules (#1615)

* docs: Clarify that commands will be passed in on stdin

* docs: Clearer instruction how to include individual custom modules

* docs: Include link to #1252 in docs for custom modules

That issue is used to share custom modules.

* docs: Remove reference to prompt_order

Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com>

Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com>
This commit is contained in:
Jan Katins
2020-09-01 19:07:12 +02:00
committed by GitHub
parent 567ea8d2be
commit 17e8115f16
3 changed files with 18 additions and 9 deletions
+13 -4
View File
@@ -2276,9 +2276,16 @@ Multiple custom modules can be defined by using a `.`.
::: tip
The order in which custom modules are shown can be individually set
by setting `custom.foo` in `prompt_order`. By default, the `custom` module
will simply show all custom modules in the order they were defined.
The order in which custom modules are shown can be individually set by including
`${custom.foo}` in the top level `format` (as it includes a dot, you need to use `${...}`).
By default, the `custom` module will simply show all custom modules in the order they were defined.
:::
::: tip
[Issue #1252](https://github.com/starship/starship/discussions/1252) contains examples of custom modules.
If you have an interesting example not covered there, feel free to share it there!
:::
@@ -2286,7 +2293,7 @@ will simply show all custom modules in the order they were defined.
| Option | Default | Description |
| ------------- | ----------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| `command` | | The command whose output should be printed. |
| `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`. |
@@ -2317,6 +2324,8 @@ will simply show all custom modules in the order they were defined.
If unset, it will fallback to STARSHIP_SHELL and then to "sh" on Linux, and "cmd /C" on Windows.
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 -`.
This behavior can be avoided by explicitly passing arguments to the shell, e.g.