mirror of
https://github.com/starship/starship.git
synced 2026-06-22 02:02:12 +07:00
fix(custom): improve handling of Powershell prompts (#1237)
To improve overall support of PowerShell in custom modules, the ability to pass arguments to the shell was also added. Additionally, the arguments `-NoProfile -Command -` will be automatically passed to PowerShell, unless other arguments are given by the user.
This commit is contained in:
+17
-1
@@ -1420,7 +1420,7 @@ will simply show all custom modules in the order they were defined.
|
||||
| ------------- | ------------------- | ---------------------------------------------------------------------------- |
|
||||
| `command` | | The command whose output should be printed. |
|
||||
| `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` | | The path to the shell to use to execute the command. If unset, it will fallback to STARSHIP_SHELL and then to "sh". |
|
||||
| `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. |
|
||||
@@ -1431,6 +1431,22 @@ will simply show all custom modules in the order they were defined.
|
||||
| `suffix` | `""` | Suffix to display immediately after the command output. |
|
||||
| `disabled` | `false` | Disables this `custom` module. |
|
||||
|
||||
#### Custom command shell
|
||||
|
||||
`shell` accepts a non-empty list of strings, where:
|
||||
- The first string is the path to the shell to use to execute the command.
|
||||
- Other following arguments are passed to the shell.
|
||||
|
||||
If unset, it will fallback to STARSHIP_SHELL and then to "sh" on Linux, and "cmd /C" on Windows.
|
||||
|
||||
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.
|
||||
|
||||
```toml
|
||||
shell = ["pwsh", "-Command", "-"]
|
||||
```
|
||||
|
||||
### Example
|
||||
|
||||
```toml
|
||||
|
||||
Reference in New Issue
Block a user