summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Hans <artnim@users.noreply.github.com>2024-04-16 19:38:58 +0200
committerGitHub <noreply@github.com>2024-04-16 19:38:58 +0200
commitefa8de0b52dda6b51bded60c0b26b6dce2dfa354 (patch)
tree378519db037080a00de2fcd788053a4a4c317535
parentb26000d1685fa61bddddea42e2a606b2a0d64e25 (diff)
downloadzsh-efa8de0b52dda6b51bded60c0b26b6dce2dfa354.tar.gz
zsh-efa8de0b52dda6b51bded60c0b26b6dce2dfa354.tar.bz2
zsh-efa8de0b52dda6b51bded60c0b26b6dce2dfa354.zip
fix(history): fix edge cases introduced in #12341 (#12357)
-rw-r--r--lib/history.zsh12
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/history.zsh b/lib/history.zsh
index 56dda2462..ec89bc15e 100644
--- a/lib/history.zsh
+++ b/lib/history.zsh
@@ -1,22 +1,20 @@
## History wrapper
function omz_history {
- local clear list
- zparseopts -E c=clear l=list
+ # parse arguments and remove from $@
+ local clear list stamp
+ zparseopts -E -D c=clear l=list f=stamp E=stamp i=stamp
if [[ $# -eq 0 ]]; then
# if no arguments provided, show full history starting from 1
- builtin fc -l 1
+ builtin fc $stamp -l 1
elif [[ -n "$clear" ]]; then
# if -c provided, clobber the history file
echo -n >| "$HISTFILE"
fc -p "$HISTFILE"
echo >&2 History file deleted.
- elif [[ -n "$list" ]]; then
- # if -l provided, run as if calling `fc' directly
- builtin fc "$@"
else
# otherwise, run `fc -l` with a custom format
- builtin fc -l "$@"
+ builtin fc $stamp -l "$@"
fi
}