bashly 1.1.6 → 1.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -9
- data/lib/bashly/libraries/test/approvals.bash +3 -3
- data/lib/bashly/script/command.rb +5 -0
- data/lib/bashly/version.rb +1 -1
- data/lib/bashly/views/argument/validations.gtx +18 -7
- data/lib/bashly/views/command/parse_requirements.gtx +1 -0
- data/lib/bashly/views/command/parse_requirements_case_catch_all.gtx +0 -1
- data/lib/bashly/views/command/parse_requirements_case_repeatable.gtx +0 -1
- data/lib/bashly/views/command/parse_requirements_case_simple.gtx +0 -1
- data/lib/bashly/views/command/validations.gtx +7 -0
- data/lib/bashly/views/flag/case_arg.gtx +0 -1
- data/lib/bashly/views/flag/validations.gtx +17 -6
- data/lib/bashly.rb +2 -2
- 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: 0a7e677e8b16a4711ece6638e16e585b1bf74fca12cc6c3e9ea4810c209d4693
|
4
|
+
data.tar.gz: 630667bb3c3d36055a0160f05719a9561d8ec7cdbd02af80fd9c2a7a5edabd17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7dd08f97c66d81979c68b43d356b650ec50d30b0c2d0d8663388f0fec56f881bd5b140a55719143e00d155b2f0ae321d6207bf63c7e248d324489cf7dc3b7cee
|
7
|
+
data.tar.gz: 754c2b4aaa9e289b04e83e10b861933b26ef3168620315a7a9655c8dc991c095d0e42037a43d379b2d1f86d6f4eb5a6e3d6ea70009642d873e7dafb1627cfffa
|
data/README.md
CHANGED
@@ -27,15 +27,6 @@ usually handled by a framework in any other programming language.
|
|
27
27
|
It is available both as a [ruby gem](https://rubygems.org/gems/bashly) and as
|
28
28
|
a [docker image](https://hub.docker.com/r/dannyben/bashly).
|
29
29
|
|
30
|
-
## Bashly is Sponsored By
|
31
|
-
|
32
|
-
<table>
|
33
|
-
<tr>
|
34
|
-
<td><a href="https://rhodecode.com/"><img src='support/img/RhodeCode-logo.png' width=240></a></td>
|
35
|
-
</tr>
|
36
|
-
</table>
|
37
|
-
|
38
|
-
|
39
30
|
## Documentation
|
40
31
|
|
41
32
|
- [Bashly Homepage][docs]
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# approvals.bash v0.4.
|
1
|
+
# approvals.bash v0.4.2
|
2
2
|
#
|
3
3
|
# Interactive approval testing for Bash.
|
4
4
|
# https://github.com/DannyBen/approvals.bash
|
@@ -9,8 +9,8 @@ approve() {
|
|
9
9
|
cmd=$1
|
10
10
|
last_exit_code=0
|
11
11
|
actual=$(eval "$cmd" 2>&1) || last_exit_code=$?
|
12
|
-
if [[ "$allow_diff_regex" ]]; then
|
13
|
-
actual=$(echo "$actual" | sed "s/$allow_diff_regex/*/g")
|
12
|
+
if [[ -v allow_diff_regex && "$allow_diff_regex" ]]; then
|
13
|
+
actual=$(echo "$actual" | sed -E "s/$allow_diff_regex/*/g")
|
14
14
|
unset allow_diff_regex
|
15
15
|
fi
|
16
16
|
approval=$(printf "%b" "$cmd" | tr -s -c "[:alnum:]" _)
|
@@ -322,6 +322,11 @@ module Bashly
|
|
322
322
|
@user_lib ||= Dir["#{Settings.full_lib_dir}/**/*.#{Settings.partials_extension}"]
|
323
323
|
end
|
324
324
|
|
325
|
+
# Returns a mixed array of Argument and Flag objects that have validations
|
326
|
+
def validatables
|
327
|
+
@validatables ||= args.select(&:validate) + flags.select(&:validate)
|
328
|
+
end
|
329
|
+
|
325
330
|
# Returns an array of all the args with a whitelist
|
326
331
|
def whitelisted_args
|
327
332
|
args.select(&:allowed)
|
data/lib/bashly/version.rb
CHANGED
@@ -1,11 +1,22 @@
|
|
1
1
|
if validate
|
2
|
+
= view_marker
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
>
|
6
|
-
>
|
7
|
-
>
|
8
|
-
>
|
9
|
-
>
|
4
|
+
if repeatable
|
5
|
+
> if [[ -v args['{{ name }}'] ]]; then
|
6
|
+
> eval "values=(${args['{{ name }}']})"
|
7
|
+
> for value in "${values[@]}"; do
|
8
|
+
> if [[ -n $(validate_{{ validate }} "$value") ]]; then
|
9
|
+
> printf "{{ strings[:validation_error] }}\n" "{{ name.upcase }}" "$(validate_{{ validate }} "$value")" >&2
|
10
|
+
> exit 1
|
11
|
+
> fi
|
12
|
+
> done
|
13
|
+
> fi
|
14
|
+
else
|
15
|
+
> if [[ -v args['{{ name }}'] && -n $(validate_{{ validate }} "${args['{{ name }}']:-}") ]]; then
|
16
|
+
> printf "{{ strings[:validation_error] }}\n" "{{ name.upcase }}" "$(validate_{{ validate }} "${args['{{ name }}']:-}")" >&2
|
17
|
+
> exit 1
|
18
|
+
> fi
|
19
|
+
>
|
20
|
+
end
|
10
21
|
|
11
22
|
end
|
@@ -1,11 +1,22 @@
|
|
1
1
|
if validate
|
2
|
-
|
3
2
|
= view_marker
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
if repeatable
|
5
|
+
> if [[ -v args['{{ long }}'] ]]; then
|
6
|
+
> eval "values=(${args['{{ long }}']})"
|
7
|
+
> for value in "${values[@]}"; do
|
8
|
+
> if [[ -n $(validate_{{ validate }} "$value") ]]; then
|
9
|
+
> printf "{{ strings[:validation_error] }}\n" "{{ usage_string }}" "$(validate_{{ validate }} "$value")" >&2
|
10
|
+
> exit 1
|
11
|
+
> fi
|
12
|
+
> done
|
13
|
+
> fi
|
14
|
+
else
|
15
|
+
> if [[ -v args['{{ long }}'] && -n $(validate_{{ validate }} "${args['{{ long }}']:-}") ]]; then
|
16
|
+
> printf "{{ strings[:validation_error] }}\n" "{{ usage_string }}" "$(validate_{{ validate }} "${args['{{ long }}']:-}")" >&2
|
17
|
+
> exit 1
|
18
|
+
> fi
|
19
|
+
>
|
20
|
+
end
|
10
21
|
|
11
22
|
end
|
data/lib/bashly.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bashly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danny Ben Shitrit
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colsole
|
@@ -265,6 +265,7 @@ files:
|
|
265
265
|
- lib/bashly/views/command/user_filter.gtx
|
266
266
|
- lib/bashly/views/command/user_hooks.gtx
|
267
267
|
- lib/bashly/views/command/user_lib.gtx
|
268
|
+
- lib/bashly/views/command/validations.gtx
|
268
269
|
- lib/bashly/views/command/version_command.gtx
|
269
270
|
- lib/bashly/views/command/whitelist_filter.gtx
|
270
271
|
- lib/bashly/views/environment_variable/usage.gtx
|
@@ -301,7 +302,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
301
302
|
- !ruby/object:Gem::Version
|
302
303
|
version: '0'
|
303
304
|
requirements: []
|
304
|
-
rubygems_version: 3.
|
305
|
+
rubygems_version: 3.5.6
|
305
306
|
signing_key:
|
306
307
|
specification_version: 4
|
307
308
|
summary: Bash Command Line Tool Generator
|