plugins-help is much faster

this replaces the naive implementation that called glossary() on each
group, and is an order of magnitude faster.

fix grouping in javascript.plugin.bash
This commit is contained in:
Erich Smith
2012-05-15 14:25:42 -04:00
parent e14543a4bc
commit a825c5f16f
2 changed files with 27 additions and 10 deletions

View File

@@ -127,18 +127,35 @@ enable-plugin ()
plugins-help () plugins-help ()
{ {
about 'list all plugins and functions defined by bash-it' about 'summarize all functions defined by enabled bash-it plugins'
group 'lib' group 'lib'
printf '%s\n' "bash-it plugins help" # display a brief progress message...
printf '\n' printf '%s' 'please wait, building help...'
typeset group typeset grouplist=$(mktemp /tmp/grouplist.XXXX)
for group in $(all_groups) typeset func
for func in $(typeset_functions)
do do
printf '%s\n' "group: $group" typeset group="$(typeset -f $func | metafor group)"
glossary $group if [ -z "$group" ]; then
printf '\n' group='misc'
fi
typeset about="$(typeset -f $func | metafor about)"
letterpress "$about" $func >> $grouplist.$group
echo $grouplist.$group >> $grouplist
done done
# clear progress message
printf '\r%s\n' ' '
typeset group
typeset gfile
for gfile in $(cat $grouplist | sort | uniq)
do
printf '%s\n' "${gfile##*.}:"
cat $gfile
printf '\n'
rm $gfile 2> /dev/null
done | less
rm $grouplist 2> /dev/null
} }
all_groups () all_groups ()

View File

@@ -15,7 +15,7 @@ function rails_jquery {
function jquery_install { function jquery_install {
about 'download jquery.js into public/javascripts' about 'download jquery.js into public/javascripts'
group 'javascripts' group 'javascript'
if [ -z "$1" ] if [ -z "$1" ]
then then
@@ -28,7 +28,7 @@ function jquery_install {
function jquery_ui_install { function jquery_ui_install {
about 'download jquery_us.js into public/javascripts' about 'download jquery_us.js into public/javascripts'
group 'javascripts' group 'javascript'
if [ -z "$1" ] if [ -z "$1" ]
then then