FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

plugins-help is much faster · gitanicsoftware/bash-it@a825c5f · GitHub

Repository navigation

Commit a825c5f

Browse files
committed
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
1 parent e14543a commit a825c5f

2 files changed

Lines changed: 26 additions & 9 deletions

File tree

‎lib/helpers.bash‎

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,18 +127,35 @@ enable-plugin ()
127127

128128
plugins-help ()
129129
{
130-
about 'list all plugins and functions defined by bash-it'
130+
about 'summarize all functions defined by enabled bash-it plugins'
131131
group 'lib'
132132

133-
printf '%s\n' "bash-it plugins help"
134-
printf '\n'
133+
# display a brief progress message...
134+
printf '%s' 'please wait, building help...'
135+
typeset grouplist=$(mktemp /tmp/grouplist.XXXX)
136+
typeset func
137+
for func in $(typeset_functions)
138+
do
139+
typeset group="$(typeset -f $func | metafor group)"
140+
if [ -z "$group" ]; then
141+
group='misc'
142+
fi
143+
typeset about="$(typeset -f $func | metafor about)"
144+
letterpress "$about" $func >> $grouplist.$group
145+
echo $grouplist.$group >> $grouplist
146+
done
147+
# clear progress message
148+
printf '\r%s\n' ' '
135149
typeset group
136-
for group in $(all_groups)
150+
typeset gfile
151+
for gfile in $(cat $grouplist | sort | uniq)
137152
do
138-
printf '%s\n' "group: $group"
139-
glossary $group
153+
printf '%s\n' "${gfile##*.}:"
154+
cat $gfile
140155
printf '\n'
141-
done
156+
rm $gfile 2> /dev/null
157+
done | less
158+
rm $grouplist 2> /dev/null
142159
}
143160

144161
all_groups ()

‎plugins/available/javascript.plugin.bash‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function rails_jquery {
1515

1616
function jquery_install {
1717
about 'download jquery.js into public/javascripts'
18-
group 'javascripts'
18+
group 'javascript'
1919

2020
if [ -z "$1" ]
2121
then
@@ -28,7 +28,7 @@ function jquery_install {
2828

2929
function jquery_ui_install {
3030
about 'download jquery_us.js into public/javascripts'
31-
group 'javascripts'
31+
group 'javascript'
3232

3333
if [ -z "$1" ]
3434
then

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL