From a8f8b33cd79059c4b448f3203b55e879bd64160b Mon Sep 17 00:00:00 2001 From: nash Date: Sun, 15 Sep 2024 14:46:43 +0800 Subject: [PATCH] Fix issues related to quoting Allow filtering of records related to the current session. --- modules/history-utils/mod.nu | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/history-utils/mod.nu b/modules/history-utils/mod.nu index fee6b9355..612e1cf12 100644 --- a/modules/history-utils/mod.nu +++ b/modules/history-utils/mod.nu @@ -1,5 +1,6 @@ def quote [...t] { - $"'($t | str join '')'" + let s = $t | str join '' | str replace -a "'" "''" + $"'($s)'" } def flatten_fields [args] { @@ -40,6 +41,7 @@ export def 'history timing' [ pattern? --exclude(-x): string --num(-n)=10 + --current(-c) --all(-a) ] { open $nu.history-path | query db (sql { @@ -48,6 +50,7 @@ export def 'history timing' [ "cmd not like 'history timing%'" (if ($pattern | is-not-empty) {[cmd like (quote '%' $pattern '%')]}) (if ($exclude | is-not-empty) {[cmd not like (quote '%' $exclude '%')]}) + (if $current {[session_id = (history session)]}) (if not $all {[cwd = (quote $env.PWD)]}) ] orderBy: [[start desc]]