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
pull/134/head
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 ()
{
about 'list all plugins and functions defined by bash-it'
about 'summarize all functions defined by enabled bash-it plugins'
group 'lib'
printf '%s\n' "bash-it plugins help"
printf '\n'
typeset group
for group in $(all_groups)
# display a brief progress message...
printf '%s' 'please wait, building help...'
typeset grouplist=$(mktemp /tmp/grouplist.XXXX)
typeset func
for func in $(typeset_functions)
do
printf '%s\n' "group: $group"
glossary $group
printf '\n'
typeset group="$(typeset -f $func | metafor group)"
if [ -z "$group" ]; then
group='misc'
fi
typeset about="$(typeset -f $func | metafor about)"
letterpress "$about" $func >> $grouplist.$group
echo $grouplist.$group >> $grouplist
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 ()

View File

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