mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-18 10:22:00 +00:00
parent
b26000d168
commit
efa8de0b52
1 changed files with 5 additions and 7 deletions
|
@ -1,22 +1,20 @@
|
||||||
## History wrapper
|
## History wrapper
|
||||||
function omz_history {
|
function omz_history {
|
||||||
local clear list
|
# parse arguments and remove from $@
|
||||||
zparseopts -E c=clear l=list
|
local clear list stamp
|
||||||
|
zparseopts -E -D c=clear l=list f=stamp E=stamp i=stamp
|
||||||
|
|
||||||
if [[ $# -eq 0 ]]; then
|
if [[ $# -eq 0 ]]; then
|
||||||
# if no arguments provided, show full history starting from 1
|
# if no arguments provided, show full history starting from 1
|
||||||
builtin fc -l 1
|
builtin fc $stamp -l 1
|
||||||
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 -p "$HISTFILE"
|
fc -p "$HISTFILE"
|
||||||
echo >&2 History file deleted.
|
echo >&2 History file deleted.
|
||||||
elif [[ -n "$list" ]]; then
|
|
||||||
# if -l provided, run as if calling `fc' directly
|
|
||||||
builtin fc "$@"
|
|
||||||
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…
Reference in a new issue