-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add examples & installation instructions
Address issue #2.
- Loading branch information
1 parent
c724262
commit f8da109
Showing
2 changed files
with
72 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,44 @@ | ||
#!/bin/zsh | ||
emulate -L zsh -o noshortloops -o warncreateglobal -o extendedglob -o rcquotes | ||
emulate -L zsh -o warncreateglobal -o extendedglob | ||
|
||
local key value | ||
|
||
print 'Usage:' | ||
print ' hist [options] <action> [selection] -> $reply' | ||
print -l | ||
print 'Return value:' | ||
print ' reply an associative array of history (index, entry) tuples' | ||
print -l | ||
print 'Options (can be combined):' | ||
print -l \ | ||
'Usage:' \ | ||
' hist [options] <action> [selection] -> $reply' \ | ||
'' \ | ||
'Return value:' \ | ||
' reply an associative array of history (index, entry) tuples' \ | ||
'' \ | ||
'Options (can be combined):' | ||
for key in ${(ko@)_HIST__OPTS}; do | ||
print " $key ${_HIST__OPTS[$key]}" | ||
done | ||
print 'By default, hist asks for confirmation only when operating on multiple history entries.' | ||
print -l | ||
print 'Actions (required; mutually exclusive):' | ||
print -l \ | ||
'By default, hist asks for confirmation only when operating on multiple history entries.' \ | ||
'' \ | ||
'Actions (required; mutually exclusive):' | ||
for key in ${(ko@)_HIST__ARGS}; do | ||
print " $key ${_HIST__ARGS[$key]}" | ||
done | ||
print -l | ||
print 'Selection (required for some actions; mutually exclusive):' | ||
print ' empty or 0 pushed lines' | ||
print ' positive integer index from beginning of history' | ||
print ' negative integer offset from end of history' | ||
print ' string pattern to match; can select multiple entries' | ||
print -l \ | ||
'' \ | ||
'Selection (required for some actions; mutually exclusive):' \ | ||
' empty or 0 pushed lines' \ | ||
' positive integer index from beginning of history' \ | ||
' negative integer offset from end of history' \ | ||
' string pattern to match; can select multiple entries' \ | ||
'' \ | ||
'' \ | ||
'--Examples--' \ | ||
'' \ | ||
'Delete all history items starting with `fc `:' \ | ||
$' hist d \'fc *\'' \ | ||
'' \ | ||
'List all history items starting with `git ` and ending with `lease`:' \ | ||
$' hist l \'git *lease\'' \ | ||
'' \ | ||
'Fix the last history item: Cut from history, paste into command line.' \ | ||
' hist f -1' \ | ||
'' | ||
|