|
@@ -8,7 +8,19 @@ shellfu import pretty
|
8
|
8
|
#
|
9
|
9
|
|
10
|
10
|
usage() {
|
11
|
|
- mkusage "script"
|
|
11
|
+ mkusage "$@" "[options] SCRIPT" \
|
|
12
|
+ -- \
|
|
13
|
+ "Run SCRIPT, see what it would load and print its 'portable'" \
|
|
14
|
+ "version, ie. with those modules embedded inside." \
|
|
15
|
+ -o \
|
|
16
|
+ "-v enable verbose output" \
|
|
17
|
+ "-d enable debugging output" \
|
|
18
|
+ -- \
|
|
19
|
+ "WARNING: sfembed is highly experimental, probably dangerous and" \
|
|
20
|
+ "does not always work (namely, if module loading is dynamic)." \
|
|
21
|
+ -- \
|
|
22
|
+ "Calling sfembed WILL RUN provided SCRIPT (with no arguments);" \
|
|
23
|
+ "currently that's how it finds out what the SCRIPT would need."
|
12
|
24
|
}
|
13
|
25
|
|
14
|
26
|
chk_applicable() {
|
|
@@ -115,11 +127,11 @@ main() {
|
115
|
127
|
while true; do case "$1" in
|
116
|
128
|
-d) PRETTY_DEBUG=true; shift ;;
|
117
|
129
|
-v) PRETTY_VERBOSE=true; shift ;;
|
118
|
|
- -*) usage ;;
|
|
130
|
+ -*) usage -w "unknown argument: $1" ;;
|
119
|
131
|
*) break ;;
|
120
|
132
|
esac done
|
121
|
133
|
Script="$1"
|
122
|
|
- test -n "$Script" || usage
|
|
134
|
+ test -n "$Script" || usage -w "no SCRIPT?"
|
123
|
135
|
test -f "$Script" || die "no such file: $Script"
|
124
|
136
|
test -r "$Script" || die "cannot read: $Script"
|
125
|
137
|
chk_applicable "$Script" || die "not applicable for embedding: $Script"
|