mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-30 02:44:42 +01:00
fix(history): fix edge cases, add comments
This commit is contained in:
parent
324a56d3f5
commit
b0bf6bcfb3
1 changed files with 4 additions and 3 deletions
|
|
@ -1,5 +1,6 @@
|
|||
## History wrapper
|
||||
function omz_history {
|
||||
# parse arguments and remove from $@
|
||||
local clear list stamp
|
||||
zparseopts -E -D c=clear l=list f=stamp E=stamp i=stamp
|
||||
|
||||
|
|
@ -9,14 +10,14 @@ function omz_history {
|
|||
elif [[ -n "$clear" ]]; then
|
||||
# if -c provided, clobber the history file
|
||||
echo -n >| "$HISTFILE"
|
||||
fc $stamp -p "$HISTFILE"
|
||||
fc -p "$HISTFILE"
|
||||
echo >&2 History file deleted.
|
||||
elif [[ -n "$list" ]]; then
|
||||
# if -l provided, run as if calling `fc' directly
|
||||
builtin fc $stamp "$@"
|
||||
builtin fc $stamp -l "$@"
|
||||
else
|
||||
# otherwise, run `fc -l` with a custom format
|
||||
builtin fc -l "$@"
|
||||
builtin fc $stamp -l "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue