-
Notifications
You must be signed in to change notification settings - Fork 2
/
bashfoo-bundle
executable file
·53 lines (47 loc) · 1.08 KB
/
bashfoo-bundle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
##
## bashfoo-bundle - bash linker
##
## creates self-contained bash script bundle by linking all required scripts
##
## usage
## bashfoo-bundle MODULE [MODULE ...]
##
## Requirements for modules are specified as `bashfoo-source MODULE` phrases contained
## somewhere in script (usually at top, as comments).
##
## Example:
## foo.sh:
## foo() {
## echo foo
## }
## script.sh:
##
## # bashfoo-source foo.sh
## # bashfoo-source
##
## foo
##
## The `bashfoo-bundle script.sh` will create concatenation of `foo.sh` and `script.sh`.
## The dep tree is traversed in depth-first order.
##
eval `bashfoo --eval-out`
bashfoo_require log
bashfoo_require bundle
bashfoo_require auto_usage
maybe_show_auto_help $1
if [ -z "$1" ] ; then
log_error "bad usage: at least one module needed"
exit 1
fi
#
# this stub ensures that bashfoo bootstrap/require functions are noop in context
# of bundled script
#
# not this gem: { : ; } - it's bash empty function yeah !
#
cat << 'EOF'
bashfoo_require() { : ; }
bashfoo() { : ; }
bashfoo-source() { : ; }
EOF
export_modules_recursive "$@"