alox-jason 0.0.27 → 0.0.28

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/exec/_jason +134 -0
  2. data/exec/_log4sh +3842 -0
  3. data/exec/_shflags +1012 -0
  4. data/exec/_sub +56 -0
  5. metadata +6 -2
data/exec/_sub ADDED
@@ -0,0 +1,56 @@
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
+ echo "Command $sub_base $1 not implemented" 1>&2
13
+ else
14
+ echo "Command $sub_base not implemented" 1>&2
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="$(type -P "${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="$(type -P "${sub_base}-$1" || true)"
34
+
35
+ if [[ -x "$sub_cmd" ]]; then
36
+ shift
37
+ exec "$sub_cmd" "$@"
38
+ fi
39
+ fi
40
+ fi
41
+
42
+ if [[ -x "$bsource_cmd" && "$bsource_cmd" != "$bsource" ]]; then
43
+ exec "$bsource_cmd" "$@"
44
+ else
45
+ if [[ "$(type -t main)" = "function" ]]; then
46
+ main "$@"
47
+ else
48
+ logger_fatal "Can't run $sub_base, missing main function"
49
+ exit 1
50
+ fi
51
+ fi
52
+ }
53
+
54
+ if [[ "$#" > 0 ]]; then
55
+ sub "$@"
56
+ fi
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alox-jason
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.27
4
+ version: 0.0.28
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -19,7 +19,11 @@ email:
19
19
  executables: []
20
20
  extensions: []
21
21
  extra_rdoc_files: []
22
- files: []
22
+ files:
23
+ - exec/_jason
24
+ - exec/_log4sh
25
+ - exec/_shflags
26
+ - exec/_sub
23
27
  homepage: https://github.com/destructuring/jason
24
28
  licenses: []
25
29
  post_install_message: