Add omz-readme to show the READMEs of modules
This commit is contained in:
parent
9224c653f9
commit
69d30b61ca
2 changed files with 29 additions and 0 deletions
|
@ -12,6 +12,7 @@ Aliases
|
|||
Functions
|
||||
---------
|
||||
|
||||
- `omz-readme` shows the README of OMZ or OMZ modules
|
||||
- `mkdcd` makes a directory and changes to it.
|
||||
- `cdls` changes to a directory and lists its contents.
|
||||
- `pushdls` pushes an entry onto the directory stack and lists its contents.
|
||||
|
|
28
modules/utility/functions/omz-readme
Normal file
28
modules/utility/functions/omz-readme
Normal file
|
@ -0,0 +1,28 @@
|
|||
#
|
||||
# Displays a README of OMZ or OMZ modules
|
||||
#
|
||||
# Authors:
|
||||
# Sebastian Wiesner <lunaryorn@googlemail.com>
|
||||
#
|
||||
|
||||
local -a readmes
|
||||
local readme
|
||||
|
||||
if (( $# == 0 )); then
|
||||
readmes=("$OMZ/README.md")
|
||||
else
|
||||
for module in "$argv[@]"; do
|
||||
readme="$OMZ/modules/$module/README.md"
|
||||
if [[ -f $readme ]]; then
|
||||
readmes+=("$readme")
|
||||
elif [[ ! -d "$OMZ/modules/$module" ]]; then
|
||||
print "unknown module $module" >&2
|
||||
else
|
||||
print "no README in module $module" >&2
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if (( $#readmes )); then
|
||||
$PAGER "$readmes[@]"
|
||||
fi
|
Loading…
Add table
Reference in a new issue