# functions
usage () {
echo " USAGE"
- echo " ./builder <command> [-d|--dryrun] [-a|--allfiles] [-s|--short] ..."
+ echo " ./builder <command> [-d|--dryrun] [-a|-p|--allfiles|--devfiles] [-s|--short] ..."
echo " ./builder <-h|--help|help>"
echo " commands are:"
echo " create"
}
one_or_all() {
- if [ "$ALL_FILES" = "y" ]; then
- sfx_files='*'
- else
- sfx_files='*.sql'
- fi
-
- if [ "$1" = "" ]; then
- cat sql.d/$sfx_files
- else
+ if [ "$1" ]; then
cat "$1"
+ elif [ "$TYPE_FILES" = "a" ]; then
+ cat sql.d/[0-9]*
+ elif [ "$TYPE_FILES" = "d" ]; then
+ cat sql.d/[0-9]*.{sql,devel}
+ else
+ cat sql.d/[0-9]*.sql
fi
}
}
;;
-a|--allfiles)
- ALL_FILES=y
+ TYPE_FILES=a
+ ;;
+ -p|--devfiles)
+ TYPE_FILES=d
;;
-s|--short)
SHORT=y