bashly 1.2.11 → 1.2.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/bashly/libraries/libraries.yml +13 -0
- data/lib/bashly/libraries/settings/settings.yml +5 -0
- data/lib/bashly/libraries/stacktrace/stacktrace.sh +29 -0
- data/lib/bashly/libraries/validations/validate_dir_exists.sh +3 -1
- data/lib/bashly/libraries/validations/validate_file_exists.sh +3 -1
- data/lib/bashly/libraries/validations/validate_integer.sh +4 -2
- data/lib/bashly/libraries/validations/validate_not_empty.sh +3 -1
- data/lib/bashly/script/command.rb +2 -2
- data/lib/bashly/settings.rb +9 -0
- data/lib/bashly/version.rb +1 -1
- data/lib/bashly/views/command/initialize.gtx +1 -1
- data/lib/bashly/views/command/master_script.gtx +4 -4
- data/lib/bashly/views/command/run.gtx +1 -1
- data/lib/bashly/views/flag/validations.gtx +9 -5
- metadata +13 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7352576231f786aa54762d8ae255d5599da89b8a5c1eb98d39bee4f8826cf40
|
4
|
+
data.tar.gz: 847a535d109089a3296b4dfce8477f1c3d40cd62183a4aeb662e396efe9a5f95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b2c74316bd4d9d37a22e58ed20c4986a7ca86e7b74b7222e8f7adcad966f83b29d39b915ca7607f1d3655ef1653390aadcdcea173b9c9818ba475f861d8bbba
|
7
|
+
data.tar.gz: 89517c698abb34ec83e04590cd4919f59492fc0b999b3baade304dfde859c7aca231db77a9d469df0fcb7d98634913cb6d2321b6a791732f06c2cf608d962cc8
|
@@ -102,6 +102,19 @@ settings:
|
|
102
102
|
- source: "settings/settings.yml"
|
103
103
|
target: "settings.yml"
|
104
104
|
|
105
|
+
stacktrace:
|
106
|
+
help: Add a function that shows stacktrace on error.
|
107
|
+
files:
|
108
|
+
- source: "stacktrace/stacktrace.sh"
|
109
|
+
target: "%{user_lib_dir}/stacktrace.%{user_ext}"
|
110
|
+
post_install_message: |
|
111
|
+
The stacktrace function is designed to be called automatically on error.
|
112
|
+
|
113
|
+
To enable this functionality, call g`enable_stacktrace` in your
|
114
|
+
g`src/initialize.sh`. You may run the following command to add this file:
|
115
|
+
|
116
|
+
m`$ bashly add hooks`
|
117
|
+
|
105
118
|
strings:
|
106
119
|
help: Copy an additional configuration file to your project, allowing you to customize all the tips and error strings.
|
107
120
|
files:
|
@@ -0,0 +1,29 @@
|
|
1
|
+
## Stack trace functions [@bashly-upgrade stacktrace]
|
2
|
+
## This file is a part of Bashly standard library
|
3
|
+
##
|
4
|
+
## Usage:
|
5
|
+
## This function is designed to be called on error.
|
6
|
+
##
|
7
|
+
## To enable this functionality, call `enable_stacktrace` in your
|
8
|
+
## `src/initialize.sh` (Run `bashly add hooks` to add this file).
|
9
|
+
##
|
10
|
+
enable_stacktrace() {
|
11
|
+
trap 'stacktrace' ERR
|
12
|
+
set -o errtrace
|
13
|
+
set -o errexit
|
14
|
+
}
|
15
|
+
|
16
|
+
stacktrace() {
|
17
|
+
local exit_status="$?"
|
18
|
+
local i=0
|
19
|
+
local caller_output line func file
|
20
|
+
|
21
|
+
printf "%s:%s in \`%s\`: %s\n" "${BASH_SOURCE[0]}" "${BASH_LINENO[0]}" "${FUNCNAME[1]}" "$BASH_COMMAND"
|
22
|
+
printf "\nStack trace:\n"
|
23
|
+
while caller_output="$(caller $i)"; do
|
24
|
+
read -r line func file <<<"$caller_output"
|
25
|
+
printf "\tfrom %s:%s in \`%s\`\n" "$file" "$line" "$func"
|
26
|
+
i=$((i + 1))
|
27
|
+
done
|
28
|
+
exit "$exit_status"
|
29
|
+
} >&2
|
@@ -87,8 +87,8 @@ module Bashly
|
|
87
87
|
# flag with arg that is defined as unique
|
88
88
|
def has_unique_args_or_flags?
|
89
89
|
deep_commands(include_self: true).each do |command|
|
90
|
-
return true if command.args.
|
91
|
-
command.flags.
|
90
|
+
return true if command.args.any?(&:unique) ||
|
91
|
+
command.flags.any?(&:unique)
|
92
92
|
end
|
93
93
|
false
|
94
94
|
end
|
data/lib/bashly/settings.rb
CHANGED
@@ -15,6 +15,7 @@ module Bashly
|
|
15
15
|
:enable_inspect_args,
|
16
16
|
:enable_sourcing,
|
17
17
|
:enable_view_markers,
|
18
|
+
:function_names,
|
18
19
|
:lib_dir,
|
19
20
|
:partials_extension,
|
20
21
|
:private_reveal_key,
|
@@ -89,6 +90,14 @@ module Bashly
|
|
89
90
|
"#{source_dir}/#{lib_dir}"
|
90
91
|
end
|
91
92
|
|
93
|
+
def function_name(key)
|
94
|
+
function_names[key.to_s] || key.to_s
|
95
|
+
end
|
96
|
+
|
97
|
+
def function_names
|
98
|
+
@function_names ||= get :function_names
|
99
|
+
end
|
100
|
+
|
92
101
|
def lib_dir
|
93
102
|
@lib_dir ||= get :lib_dir
|
94
103
|
end
|
data/lib/bashly/version.rb
CHANGED
@@ -15,11 +15,11 @@
|
|
15
15
|
>
|
16
16
|
if Settings.enabled? :sourcing
|
17
17
|
> if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
18
|
-
> initialize
|
19
|
-
> run "$@"
|
18
|
+
> {{ Settings.function_name :initialize }}
|
19
|
+
> {{ Settings.function_name :run }} "$@"
|
20
20
|
> fi
|
21
21
|
else
|
22
|
-
> initialize
|
23
|
-
> run "$@"
|
22
|
+
> {{ Settings.function_name :initialize }}
|
23
|
+
> {{ Settings.function_name :run }} "$@"
|
24
24
|
end
|
25
25
|
>
|
@@ -6,16 +6,20 @@ if validate
|
|
6
6
|
> values=''
|
7
7
|
> eval "values=(${args['{{ long }}']})"
|
8
8
|
> for value in "${values[@]}"; do
|
9
|
-
>
|
10
|
-
>
|
9
|
+
> validation_output="$(validate_{{ validate }} "$value")"
|
10
|
+
> if [[ -n "$validation_output" ]]; then
|
11
|
+
> printf "{{ strings[:validation_error] }}\n" "{{ usage_string }}" "$validation_output" >&2
|
11
12
|
> exit 1
|
12
13
|
> fi
|
13
14
|
> done
|
14
15
|
> fi
|
15
16
|
else
|
16
|
-
> if [[ -v args['{{ long }}']
|
17
|
-
>
|
18
|
-
>
|
17
|
+
> if [[ -v args['{{ long }}'] ]]; then
|
18
|
+
> validation_output="$(validate_{{ validate }} "${args['{{ long }}']:-}")"
|
19
|
+
> if [[ -n "${validation_output}" ]]; then
|
20
|
+
> printf "{{ strings[:validation_error] }}\n" "{{ usage_string }}" "$validation_output" >&2
|
21
|
+
> exit 1
|
22
|
+
> fi
|
19
23
|
> fi
|
20
24
|
>
|
21
25
|
end
|
metadata
CHANGED
@@ -1,54 +1,42 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bashly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danny Ben Shitrit
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: colsole
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
15
15
|
requirements:
|
16
|
-
- - "
|
17
|
-
- !ruby/object:Gem::Version
|
18
|
-
version: 0.8.1
|
19
|
-
- - "<"
|
16
|
+
- - "~>"
|
20
17
|
- !ruby/object:Gem::Version
|
21
|
-
version: '
|
18
|
+
version: '1.0'
|
22
19
|
type: :runtime
|
23
20
|
prerelease: false
|
24
21
|
version_requirements: !ruby/object:Gem::Requirement
|
25
22
|
requirements:
|
26
|
-
- - "
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
version: 0.8.1
|
29
|
-
- - "<"
|
23
|
+
- - "~>"
|
30
24
|
- !ruby/object:Gem::Version
|
31
|
-
version: '
|
25
|
+
version: '1.0'
|
32
26
|
- !ruby/object:Gem::Dependency
|
33
27
|
name: completely
|
34
28
|
requirement: !ruby/object:Gem::Requirement
|
35
29
|
requirements:
|
36
|
-
- - "
|
37
|
-
- !ruby/object:Gem::Version
|
38
|
-
version: 0.6.1
|
39
|
-
- - "<"
|
30
|
+
- - "~>"
|
40
31
|
- !ruby/object:Gem::Version
|
41
|
-
version:
|
32
|
+
version: 0.7.0
|
42
33
|
type: :runtime
|
43
34
|
prerelease: false
|
44
35
|
version_requirements: !ruby/object:Gem::Requirement
|
45
36
|
requirements:
|
46
|
-
- - "
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
version: 0.6.1
|
49
|
-
- - "<"
|
37
|
+
- - "~>"
|
50
38
|
- !ruby/object:Gem::Version
|
51
|
-
version:
|
39
|
+
version: 0.7.0
|
52
40
|
- !ruby/object:Gem::Dependency
|
53
41
|
name: filewatcher
|
54
42
|
requirement: !ruby/object:Gem::Requirement
|
@@ -238,6 +226,7 @@ files:
|
|
238
226
|
- lib/bashly/libraries/render/markdown/render.rb
|
239
227
|
- lib/bashly/libraries/render/markdown/summary.txt
|
240
228
|
- lib/bashly/libraries/settings/settings.yml
|
229
|
+
- lib/bashly/libraries/stacktrace/stacktrace.sh
|
241
230
|
- lib/bashly/libraries/strings/strings.yml
|
242
231
|
- lib/bashly/libraries/test/approvals.bash
|
243
232
|
- lib/bashly/libraries/test/approve
|
@@ -355,14 +344,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
355
344
|
requirements:
|
356
345
|
- - ">="
|
357
346
|
- !ruby/object:Gem::Version
|
358
|
-
version: '3.
|
347
|
+
version: '3.2'
|
359
348
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
360
349
|
requirements:
|
361
350
|
- - ">="
|
362
351
|
- !ruby/object:Gem::Version
|
363
352
|
version: '0'
|
364
353
|
requirements: []
|
365
|
-
rubygems_version: 3.6.
|
354
|
+
rubygems_version: 3.6.9
|
366
355
|
specification_version: 4
|
367
356
|
summary: Bash Command Line Tool Generator
|
368
357
|
test_files: []
|