alox-jason 0.0.23 → 0.0.24
Sign up to get free protection for your applications and to get access to all the features.
- data/aloxec/_jason +4 -73
- metadata +1 -1
data/aloxec/_jason
CHANGED
@@ -1,9 +1,5 @@
|
|
1
1
|
#!/bin/bash
|
2
2
|
|
3
|
-
if [[ -z "${shome:-}" ]]; then
|
4
|
-
shome="$(unset CDPATH; cd -P -- "$(dirname -- "${BASH_SOURCE}")/.." && pwd -P)"
|
5
|
-
fi
|
6
|
-
|
7
3
|
function check_help {
|
8
4
|
# taken from shocco
|
9
5
|
if expr -- "$*" : ".*--help" >/dev/null; then
|
@@ -12,69 +8,8 @@ function check_help {
|
|
12
8
|
fi
|
13
9
|
}
|
14
10
|
|
15
|
-
function display_help {
|
16
|
-
flags_help
|
17
|
-
echo
|
18
|
-
|
19
|
-
# taken from shocco
|
20
|
-
grep '^#/' <"$shome/$(basename $(dirname -- "$0"))/$(basename -- "$0")" | cut -c4-
|
21
|
-
}
|
22
|
-
|
23
|
-
# Exits the script with the last error code. Servers as a marker in $0 to
|
24
|
-
# begin ronn documentation until end of file.
|
25
|
-
function __MAN__ {
|
26
|
-
exit "$!"
|
27
|
-
}
|
28
|
-
|
29
|
-
# Extracts ronn-style Markdown after __MAN__ to stdout. If a line is "MAN", it
|
30
|
-
# is assumed that a here document is used (for syntactical reasons).
|
31
|
-
#
|
32
|
-
# A limitation of detecting "MAN" will truncate the Markdown if "MAN" is a
|
33
|
-
# legimate text.
|
34
|
-
#
|
35
|
-
# __MAN__ << "MAN"
|
36
|
-
# raw ronn-style Markdown
|
37
|
-
# MAN
|
38
|
-
function display_man {
|
39
|
-
awk '/^__MAN__/,/^MAN$/ {print}' <"$0" | tail -n +2 | egrep -v '^MAN$'
|
40
|
-
}
|
41
|
-
|
42
|
-
function display_synopsis {
|
43
|
-
awk '/^#/ && !/^#!/ { print } /^[^#]/ || /^$/ { exit }' <"$0" | cut -c3-
|
44
|
-
}
|
45
|
-
|
46
|
-
function which_library {
|
47
|
-
local library="$1"; shift
|
48
|
-
if [[ -r "$shome/vendor/projects/$library/libexec/_$library" ]]; then
|
49
|
-
echo "$shome/vendor/projects/$library/libexec/_$library"
|
50
|
-
elif [[ -r "$shome/libexec/_$library" ]]; then
|
51
|
-
echo "$shome/libexec/_$library"
|
52
|
-
elif [[ -r "$shome/.$library/libexec/_$library" ]]; then
|
53
|
-
echo "$shome/.$library/libexec/_$library"
|
54
|
-
else
|
55
|
-
local nm_library="${library%%/*}"
|
56
|
-
if [[ "$nm_library" != "$library" ]]; then
|
57
|
-
local nm_right="${library##*/}"
|
58
|
-
if [[ -r "$shome/vendor/projects/$nm_library/libexec/_$nm_right" ]]; then
|
59
|
-
echo "$shome/vendor/projects/$nm_library/libexec/_$nm_right"
|
60
|
-
elif [[ -r "$shome/.$nm_library/libexec/_$nm_right" ]]; then
|
61
|
-
echo "$shome/.$nm_library/libexec/_$nm_right"
|
62
|
-
fi
|
63
|
-
fi
|
64
|
-
fi
|
65
|
-
}
|
66
|
-
|
67
11
|
function require {
|
68
|
-
|
69
|
-
local pth_lib="$(which_library "$nm_library")"
|
70
|
-
if [[ -r "$pth_lib" ]]; then
|
71
|
-
if [[ "$#" == 0 ]]; then
|
72
|
-
set --
|
73
|
-
fi
|
74
|
-
source "$pth_lib" "$@"
|
75
|
-
else
|
76
|
-
logger_warn "library $nm_library not found"
|
77
|
-
fi
|
12
|
+
source "$@"
|
78
13
|
}
|
79
14
|
|
80
15
|
function parse_command_line {
|
@@ -180,16 +115,12 @@ function mark_output {
|
|
180
115
|
}
|
181
116
|
|
182
117
|
function _main {
|
183
|
-
|
184
|
-
|
185
|
-
fi
|
186
|
-
|
187
|
-
: ${__meat__:=x}
|
188
|
-
if [[ "$__meat__" != 'x' ]]; then
|
118
|
+
: ${__jason__:=x}
|
119
|
+
if [[ "$__jason__" != 'x' ]]; then
|
189
120
|
return 0
|
190
121
|
fi
|
191
122
|
|
192
|
-
|
123
|
+
__jason__='y'
|
193
124
|
|
194
125
|
require 'shflags'
|
195
126
|
|