diff options
| author | Marc Cornellà <marc@mcornella.com> | 2024-04-18 07:12:32 +0200 |
|---|---|---|
| committer | Marc Cornellà <marc@mcornella.com> | 2024-04-18 07:12:32 +0200 |
| commit | eafa78217d836115a99f80bddfcd0a8901a15f77 (patch) | |
| tree | 58aec43c99b0467eb053aeca2becfd27908b6453 /lib/history.zsh | |
| parent | 1ed8d4b55530888bfa723e7dc6226a798260bdc8 (diff) | |
| download | zsh-eafa78217d836115a99f80bddfcd0a8901a15f77.tar.gz zsh-eafa78217d836115a99f80bddfcd0a8901a15f77.tar.bz2 zsh-eafa78217d836115a99f80bddfcd0a8901a15f77.zip | |
fix(history): fix `history -c` (#12362)
Fixes #12362
Diffstat (limited to 'lib/history.zsh')
| -rw-r--r-- | lib/history.zsh | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/history.zsh b/lib/history.zsh index ec89bc15e..aace78aa1 100644 --- a/lib/history.zsh +++ b/lib/history.zsh @@ -4,14 +4,14 @@ function omz_history { 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 $stamp -l 1 - elif [[ -n "$clear" ]]; then + if [[ -n "$clear" ]]; then # if -c provided, clobber the history file echo -n >| "$HISTFILE" fc -p "$HISTFILE" echo >&2 History file deleted. + elif [[ $# -eq 0 ]]; then + # if no arguments provided, show full history starting from 1 + builtin fc $stamp -l 1 else # otherwise, run `fc -l` with a custom format builtin fc $stamp -l "$@" |
