chore: command segment context

This commit is contained in:
Jan De Dobbeleer 2020-10-25 13:11:40 +01:00 committed by Jan De Dobbeleer
parent f3e46d872b
commit 287235f706

View file

@ -6,9 +6,15 @@ sidebar_label: Command
## What
:::info Powershell
While powerful, it tends to take a lot of time executing the command on **Powershell**.
Even with `noprofile` it's noticeably slower compared to `sh`. It's advised to look at using
[environment variables][env] when using Powershell.
:::
Command allows you run an arbitrary shell command. Be aware it spawn a new process to fetch the result, meaning
it will not be able to fetch session based context. When the command errors or returns an empty string, this
segment isn't rendered.
it will not be able to fetch session based context (look at abusing [environment variables][env] for that).
When the command errors or returns an empty string, this segment isn't rendered.
You have the ability to use `||` or `&&` to stitch commands together and achieve complex results. When using `||`
the first command that returns a string will be used (or none when they all fail to produce output that's not an
@ -38,3 +44,5 @@ error). The `&&` functionality will join the output of the commands when success
- shell: `string` - the shell in which to run the command in. Uses `shell -c command` under the hood.
- command: `string` - the command(s) to run
[env]: /docs/environment