mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-06 02:51:32 +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
|
## History wrapper
|
||||||
function omz_history {
|
function omz_history {
|
||||||
|
# parse arguments and remove from $@
|
||||||
local clear list stamp
|
local clear list stamp
|
||||||
zparseopts -E -D c=clear l=list f=stamp E=stamp i=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
|
elif [[ -n "$clear" ]]; then
|
||||||
# if -c provided, clobber the history file
|
# if -c provided, clobber the history file
|
||||||
echo -n >| "$HISTFILE"
|
echo -n >| "$HISTFILE"
|
||||||
fc $stamp -p "$HISTFILE"
|
fc -p "$HISTFILE"
|
||||||
echo >&2 History file deleted.
|
echo >&2 History file deleted.
|
||||||
elif [[ -n "$list" ]]; then
|
elif [[ -n "$list" ]]; then
|
||||||
# if -l provided, run as if calling `fc' directly
|
# if -l provided, run as if calling `fc' directly
|
||||||
builtin fc $stamp "$@"
|
builtin fc $stamp -l "$@"
|
||||||
else
|
else
|
||||||
# otherwise, run `fc -l` with a custom format
|
# otherwise, run `fc -l` with a custom format
|
||||||
builtin fc -l "$@"
|
builtin fc $stamp -l "$@"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue