fix(history): handle HIST_STAMPS with whitespace in timestamp format

Correctly handle whitespace in custom history timestamp formats.

Fixes an issue where spaces in HIST_STAMPS (e.g., "%y-%m-%d %T") caused
errors by ensuring proper quoting when passing the format to `fc`. This
resolves unintended parsing of timestamp components as invalid event
specifiers.

Closes #12365.
This commit is contained in:
Kirill Fedorov 2025-04-30 17:34:14 +03:00
commit 53c1a451c9

View file

@ -18,10 +18,10 @@ function omz_history {
print -u2 History file deleted.
elif [[ $# -eq 0 ]]; then
# if no arguments provided, show full history starting from 1
builtin fc $stamp -l 1
builtin fc "${stamp[@]}" -l 1
else
# otherwise, run `fc -l` with a custom format
builtin fc $stamp -l "$@"
builtin fc "${stamp[@]}" -l "$@"
fi
}