mirror of
https://github.com/RGBCube/ncc
synced 2025-07-29 11:07:44 +00:00
nushell: add command times to prompt
This commit is contained in:
parent
448fc820a5
commit
1761d20fa4
1 changed files with 17 additions and 4 deletions
|
@ -222,13 +222,26 @@ do --env {
|
||||||
$"(ansi cyan)($pwd)(ansi reset)"
|
$"(ansi cyan)($pwd)(ansi reset)"
|
||||||
}
|
}
|
||||||
|
|
||||||
let middle = if $env.LAST_EXIT_CODE == 0 {
|
let command_duration = ($env.CMD_DURATION_MS | into int) * 1ms
|
||||||
"━"
|
let command_duration = if $command_duration <= 2sec {
|
||||||
|
""
|
||||||
} else {
|
} else {
|
||||||
$"┫(ansi light_red_bold)($env.LAST_EXIT_CODE)(ansi light_yellow_bold)┣"
|
$"┫(ansi light_magenta_bold)($command_duration)(ansi light_yellow_bold)┣━"
|
||||||
}
|
}
|
||||||
|
|
||||||
$"(ansi light_yellow_bold)($left_char)($middle)━(ansi reset) ($body)(char newline)"
|
let exit_code = if $env.LAST_EXIT_CODE == 0 {
|
||||||
|
""
|
||||||
|
} else {
|
||||||
|
$"┫(ansi light_red_bold)($env.LAST_EXIT_CODE)(ansi light_yellow_bold)┣━"
|
||||||
|
}
|
||||||
|
|
||||||
|
let middle = if $command_duration == "" and $exit_code == "" {
|
||||||
|
"━"
|
||||||
|
} else {
|
||||||
|
""
|
||||||
|
}
|
||||||
|
|
||||||
|
$"(ansi light_yellow_bold)($left_char)($exit_code)($middle)($command_duration)(ansi reset) ($body)(char newline)"
|
||||||
}
|
}
|
||||||
|
|
||||||
$env.PROMPT_INDICATOR = $"(ansi light_yellow_bold)┃(ansi reset) "
|
$env.PROMPT_INDICATOR = $"(ansi light_yellow_bold)┃(ansi reset) "
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue