- | sed -e "/$gsu_command_regex/bs" \
- -e 'H;$!d;x;s/\n//g;b' \
- -e :s \
- -e 'x;s/\n//g;${p;x;}' \
- | sed -e "s/${gsu_command_regex}#*/\1\t/" \
- | sort \
- | while read a b; do
- printf "$a\t"
- if test ${#a} -lt 8; then
- printf "\t"
- fi
- echo "$b"
- done
+ | sed -En "/$ere/"'!d
+ # remove everything but the command name
+ s/^com_(.*)\(\).*/\1/
+
+ # append tab after short commands (less than 8 chars)
+ s/^(.{1,7})$/\1'"$tab"'/g
+
+ # remove next line (should contain only ## anyway)
+ N
+ s/#.*//
+
+ # append next line, removing leading ##
+ N
+ s/#+ *//g
+
+ # replace newline by tab
+ y/\n/'"$tab"'/
+
+ # and print the sucker
+ p'