Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Ohmyzsh
Commits
20d63be6
Commit
20d63be6
authored
Dec 18, 2014
by
Marc Cornellà
Browse files
Use zparseopts to get passed arguments
parent
f8180c3a
Changes
1
Show whitespace changes
Inline
Side-by-side
lib/history.zsh
View file @
20d63be6
...
...
@@ -2,12 +2,18 @@
function
omz_history
{
# Delete the history file if `-c' argument provided.
# This won't affect the `history' command output until the next login.
if
[[
"
${
@[(i)-c]
}
"
-le
$#
]]
;
then
zparseopts
-E
c
=
clear
l
=
list
if
[[
-n
"
$clear
"
]]
;
then
# if -c provided, clobber the history file
echo
-n
>
|
"
$HISTFILE
"
echo
>
&2 History file deleted. Reload the session to see its effects.
elif
[[
"
${
@[(i)-l]
}
"
-le
$#
]]
;
then
elif
[[
-n
"
$list
"
]]
;
then
# if -l provided, run as if calling `fc' directly
builtin fc
"
$@
"
else
# otherwise, call `fc -l 1` to show all available
# history (and pass additional parameters)
builtin fc
"
$@
"
-l
1
fi
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment