Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issues related to quoting #955

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion modules/history-utils/mod.nu
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
def quote [...t] {
$"'($t | str join '')'"
let s = $t | str join '' | str replace -a "'" "''"
$"'($s)'"
}

def flatten_fields [args] {
Expand Down Expand Up @@ -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 {
Expand All @@ -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]]
Expand Down