bashly 1.2.12 → 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/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/version.rb +1 -1
- metadata +4 -3
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/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
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
|
@@ -226,6 +226,7 @@ files:
|
|
226
226
|
- lib/bashly/libraries/render/markdown/render.rb
|
227
227
|
- lib/bashly/libraries/render/markdown/summary.txt
|
228
228
|
- lib/bashly/libraries/settings/settings.yml
|
229
|
+
- lib/bashly/libraries/stacktrace/stacktrace.sh
|
229
230
|
- lib/bashly/libraries/strings/strings.yml
|
230
231
|
- lib/bashly/libraries/test/approvals.bash
|
231
232
|
- lib/bashly/libraries/test/approve
|
@@ -350,7 +351,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
350
351
|
- !ruby/object:Gem::Version
|
351
352
|
version: '0'
|
352
353
|
requirements: []
|
353
|
-
rubygems_version: 3.6.
|
354
|
+
rubygems_version: 3.6.9
|
354
355
|
specification_version: 4
|
355
356
|
summary: Bash Command Line Tool Generator
|
356
357
|
test_files: []
|