summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPoliorcetics <poliorcetics@users.noreply.github.com>2024-04-26 13:30:06 +0200
committerGitHub <noreply@github.com>2024-04-26 12:30:06 +0100
commit36ddd98b6ef86af9b00d93d28476900b07be34ac (patch)
tree013631df2ce8408c9f01dbf5f8544307b25cb719
parenta5e9c27e74682f9757b791f7de40fb3f7a5b73b5 (diff)
perf(nushell): use version.(major|minor|patch) if available (#1963)
-rw-r--r--crates/atuin/src/shell/atuin.nu12
1 files changed, 11 insertions, 1 deletions
diff --git a/crates/atuin/src/shell/atuin.nu b/crates/atuin/src/shell/atuin.nu
index 102c6dbe..32fa65ab 100644
--- a/crates/atuin/src/shell/atuin.nu
+++ b/crates/atuin/src/shell/atuin.nu
@@ -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,
([