12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- #!/bin/bash
-
- . __FFOO_DIR__/ffoo.sh
-
- ffoo import core
-
-
- usage() {
- usage_is \
- "[-d] --version[-major|-minor|-patch|-full|-proper|-meta]" \
- "[-d] init" \
- "[-d] init_path" \
- "[-d] lsfun [module]" \
- "[-d] lsmod [pattern]" \
- "[-d] catfun module.function"
- }
-
- version_info_full() {
- echo "$(basename $0) (Fast Foo bash library) $FFOO_VERSION"
- echo
- echo "install path: __FFOO_DIR__"
- }
-
- version_info() {
- debug "1='$1'"
- local proper=$(cut -d+ -f1 <<<"$FFOO_VERSION")
- local meta=$(cut -d+ -f2- <<<"$FFOO_VERSION")
- case $1 in
- -full) echo "$FFOO_VERSION" ;;
- -proper) echo "$proper" ;;
- -major) echo $(cut -d. -f1 <<<"$proper");;
- -minor) echo $(cut -d. -f2 <<<"$proper");;
- -patch) echo $(cut -d. -f3 <<<"$proper");;
- -meta) echo "$meta";;
- *) usage ;;
- esac
- }
-
- while true; do case $1 in
- init) cat "__FFOO_DIR__/ffoo.sh"; exit $? ;;
- init_path) echo "__FFOO_DIR__/ffoo.sh"; exit 0 ;;
- lsmod) ffoo _list_modules "$2"; exit $? ;;
- lsfun) ffoo _list_functions "$2"; exit $? ;;
- catfun) ffoo _cat_function "$2"; exit $? ;;
- -d|--debug) FFOO_DEBUG=true; shift ;;
- --version) version_info_full; exit 0 ;;
- --version*) version_info "${1:9}"; exit 0 ;;
- *) usage ;;
- esac done
|