perf(nushell): use version.(major|minor|patch) if available (#1963)

This commit is contained in:
Poliorcetics 2024-04-26 13:30:06 +02:00 committed by GitHub
parent a5e9c27e74
commit 36ddd98b6e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -31,7 +31,17 @@ let _atuin_pre_prompt = {||
}
def _atuin_search_cmd [...flags: string] {
let nu_version = ($env.NU_VERSION | split row '.' | each { || into int })
let nu_version = do {
let version = version
let major = $version.major?
if $major != null {
# These members are only available in versions > 0.92.2
[$major $version.minor $version.patch]
} else {
# So fall back to the slower parsing when they're missing
$version.version | split row '.' | into int
}
}
[
$ATUIN_KEYBINDING_TOKEN,
([