alox 0.0.1 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/libexec/_sub DELETED
@@ -1,60 +0,0 @@
1
- #!/bin/bash
2
-
3
- if [[ "${BASH_SOURCE##*/}" != "_sub" ]]; then
4
- shome="$(unset CDPATH; cd -P -- "$(dirname -- "$BASH_SOURCE")/.." && pwd -P)"
5
- source "$shome/libexec/_jason"
6
- set -- "$BASH_SOURCE" "$@"
7
- fi
8
-
9
- if [[ "$(type -t main)" != "function" ]]; then
10
- function main {
11
- if [[ "$#" > 0 ]]; then
12
- logger_fatal "Command $sub_base $1 not implemented"
13
- else
14
- logger_fatal "Command $sub_base not implemented"
15
- fi
16
- exit 1
17
- }
18
- fi
19
-
20
- function sub {
21
- local bsource="$1"; shift
22
- local sub_base="$(basename "$bsource")"
23
- local bsource_cmd="$shome/libexec/${sub_base}"
24
-
25
- if [[ "$bsource_cmd" = "$bsource" ]]; then
26
- FLAGS_SUB="$FLAGS_TRUE"
27
- parse_command_line "$@" || exit $?
28
- eval set -- "${FLAGS_ARGV}"
29
- fi
30
-
31
- if [[ "$#" > 0 ]]; then
32
- if [[ ! "$1" =~ ^- ]]; then
33
- local sub_cmd="$shome/libexec/${sub_base}-$1"
34
-
35
- if [[ ! -x "$sub_cmd" ]]; then
36
- sub_cmd="$(type -P "${sub_base}-$1" || true)"
37
- fi
38
-
39
- if [[ -x "$sub_cmd" ]]; then
40
- shift
41
- exec "$sub_cmd" "$@"
42
- fi
43
- fi
44
- fi
45
-
46
- if [[ -x "$bsource_cmd" && "$bsource_cmd" != "$bsource" ]]; then
47
- exec "$bsource_cmd" "$@"
48
- else
49
- if [[ "$(type -t main)" = "function" ]]; then
50
- main "$@"
51
- else
52
- logger_fatal "Can't run $sub_base, missing main function"
53
- exit 1
54
- fi
55
- fi
56
- }
57
-
58
- if [[ "$#" > 0 ]]; then
59
- sub "$@"
60
- fi