feat(nu): validate existence of history.txt

This commit is contained in:
Grzegorz Krasoń 2024-03-05 12:36:31 +01:00 committed by GitHub
parent 70fa0bffca
commit 134f7013cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -23,7 +23,7 @@ $env.PROMPT_MULTILINE_INDICATOR = (^::OMP:: print secondary $"--config=($env.POS
$env.PROMPT_COMMAND = { ||
# hack to set the cursor line to 1 when the user clears the screen
# this obviously isn't bulletproof, but it's a start
let clear = (history | last 1 | get 0.command) == "clear"
let clear = (history | is-empty) or ((history | last 1 | get 0.command) == "clear")
^::OMP:: print primary $"--config=($env.POSH_THEME)" --shell=nu $"--shell-version=($env.POSH_SHELL_VERSION)" $"--execution-time=(posh_cmd_duration)" $"--status=($env.LAST_EXIT_CODE)" $"--terminal-width=(posh_width)" $"--cleared=($clear)"
}