(qb) Align help text

This commit is contained in:
Higor Eurípedes 2015-06-17 13:05:26 -03:00
parent f7e6b199ce
commit c0da331aa2
1 changed files with 25 additions and 16 deletions

View File

@ -1,3 +1,10 @@
print_help_option() # $1 = option $@ = description
{
_opt="$1"
shift 1
printf " %-24s %s\n" "$_opt" "$@"
}
print_help() print_help()
{ cat << EOF { cat << EOF
==================== ====================
@ -6,32 +13,34 @@ print_help()
Package: $PACKAGE_NAME Package: $PACKAGE_NAME
General environment variables: General environment variables:
CC: C compiler CC: C compiler
CFLAGS: C compiler flags CFLAGS: C compiler flags
CXX: C++ compiler CXX: C++ compiler
CXXFLAGS: C++ compiler flags CXXFLAGS: C++ compiler flags
LDFLAGS: Linker flags LDFLAGS: Linker flags
General options: General options:
--prefix=\$path: Install path prefix
--global-config-dir=\$path: System wide config file prefix
--host=HOST: cross-compile to build programs to run on HOST
--help: Show this help
Custom options:
EOF EOF
print_help_option "--prefix=PATH" "Install path prefix"
print_help_option "--global-config-dir=PATH" "System wide config file prefix"
print_help_option "--host=HOST" "cross-compile to build programs to run on HOST"
print_help_option "--help" "Show this help"
echo ""
echo "Custom options:"
while IFS='=#' read VAR VAL COMMENT; do while IFS='=#' read VAR VAL COMMENT; do
VAR=$(echo "${VAR##HAVE_}" | tr '[A-Z]' '[a-z]') VAR=$(echo "${VAR##HAVE_}" | tr '[A-Z]' '[a-z]')
case "$VAL" in case "$VAL" in
'yes'*) 'yes'*)
echo "--disable-$VAR: $COMMENT";; print_help_option "--disable-$VAR" "$COMMENT";;
'no'*) 'no'*)
echo "--enable-$VAR: $COMMENT";; print_help_option "--enable-$VAR" "$COMMENT";;
'auto'*) 'auto'*)
echo "--enable-$VAR: $COMMENT" print_help_option "--enable-$VAR" "$COMMENT"
echo "--disable-$VAR";; print_help_option "--disable-$VAR";;
*) *)
echo "--with-$VAR: $COMMENT";; print_help_option "--with-$VAR" "$COMMENT";;
esac esac
done < 'qb/config.params.sh' done < 'qb/config.params.sh'
} }