1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-08-02 23:27:45 +00:00
nu_scripts/modules/prompt/async_git_prompt/prompt.nu
Stefan Holderbach 6947014306
Replace use of $nothing with null (#621)
`$nothing` will be deprecated in nu 0.86

This accompanies
- https://github.com/nushell/nushell/pull/10478
2023-09-26 18:52:49 +02:00

31 lines
845 B
Text

# This file contains an example nushell prompt, making use of the async-git-prompt module.
use async-git-prompt.nu *
def prompt-concat [parts: table] {
$parts
| where (not ($it.text | is-empty))
| each { |it| $"($it.color)($it.text)" }
| str join ' '
}
def prompt-git-branch [] {
do -i { git rev-parse --abbrev-ref HEAD | str trim -r}
}
def prompt-create-left-prompt [] {
let pwd = ($env.PWD | str replace $env.HOME '~')
prompt-concat [
[text color];
[pwd (ansi green_bold)]
[(prompt-git-branch) (ansi blue_bold)]
[(async-git-prompt-string) (ansi green_bold)]
]
}
def prompt-create-right-prompt [] {
null
}
$env.PROMPT_COMMAND = { prompt-create-left-prompt }
$env.PROMPT_COMMAND_RIGHT = { prompt-create-right-prompt }
$env.PROMPT_INDICATOR = { $" (ansi green_bold)〉" }