bashly 0.9.1 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -4
- data/lib/bashly/version.rb +1 -1
- data/lib/bashly/views/command/command_fallback.gtx +2 -0
- data/lib/bashly/views/command/default_assignments.gtx +2 -2
- data/lib/bashly/views/command/fixed_flags_filter.gtx +2 -2
- data/lib/bashly/views/command/parse_requirements_case_catch_all.gtx +2 -2
- data/lib/bashly/views/command/parse_requirements_case_repeatable.gtx +5 -6
- data/lib/bashly/views/command/parse_requirements_case_simple.gtx +2 -2
- data/lib/bashly/views/command/required_args_filter.gtx +1 -1
- data/lib/bashly/views/command/required_flags_filter.gtx +1 -1
- data/lib/bashly/views/command/run.gtx +1 -1
- data/lib/bashly/views/command/whitelist_filter.gtx +2 -2
- data/lib/bashly/views/flag/case_arg.gtx +4 -4
- data/lib/bashly/views/flag/case_no_arg.gtx +2 -2
- data/lib/bashly/views/flag/conflicts.gtx +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ebf951958bb0478fb95b88273b87ccb2f297d36b655996b79d16c2ffdb32e773
|
4
|
+
data.tar.gz: aa3a9c218e9876fea287f141191baa4d95b40ae8b5569a7418c40911373e43ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 468d632281f56529a13770dce48d3bfbfc19433f2d32f52c0741b0d3c3ff80b15ad78b1936897e451d341f74b0d68ed6e5dd753ed4ed155984890b97ef8fbcf9
|
7
|
+
data.tar.gz: 4af3052a3d4b66b647bb461b6300eae17f72cfa61ef419f917fc6a23b881cb0af11dfb37d04628b2afedbf99f080ab04e2a5104d90d4ce148a01ceda1c2c2816
|
data/README.md
CHANGED
@@ -27,7 +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
|
-
|
31
30
|
## Documentation
|
32
31
|
|
33
32
|
- [Bashly Homepage][docs]
|
@@ -49,6 +48,7 @@ a [docker image](https://hub.docker.com/r/dannyben/bashly).
|
|
49
48
|
Bashly is responsible for:
|
50
49
|
|
51
50
|
- Generating a **single, standalone bash script**.
|
51
|
+
- Generating a **human readable, shellcheck-compliant and shfmt-compliant script**.
|
52
52
|
- Generating **usage texts** and help screens, showing your tool's arguments, flags and commands (works for sub-commands also).
|
53
53
|
- Parsing the user's command line and extracting:
|
54
54
|
- Optional or required **positional arguments**.
|
@@ -72,15 +72,12 @@ to contribute, feel free to [open an issue][issues] or
|
|
72
72
|
|
73
73
|
Visit the *[How to contribute][contributing]* page for more information.
|
74
74
|
|
75
|
-
|
76
75
|
## Stargazers and Forkers
|
77
76
|
|
78
77
|
[![Stargazers repo roster for @DannyBen/bashly](https://reporoster.com/stars/DannyBen/bashly)](https://github.com/DannyBen/bashly/stargazers)
|
79
78
|
|
80
79
|
[![Forkers repo roster for @DannyBen/bashly](https://reporoster.com/forks/DannyBen/bashly)](https://github.com/DannyBen/bashly/network/members)
|
81
80
|
|
82
|
-
|
83
|
-
|
84
81
|
[issues]: https://github.com/DannyBen/bashly/issues
|
85
82
|
[discussions]: https://github.com/DannyBen/bashly/discussions
|
86
83
|
[docs]: https://bashly.dannyb.co/
|
data/lib/bashly/version.rb
CHANGED
@@ -24,6 +24,7 @@ elsif extensible.is_a? String
|
|
24
24
|
> printf "{{ strings[:invalid_command] }}\n" "$action" >&2
|
25
25
|
> exit 1
|
26
26
|
> fi
|
27
|
+
> ;;
|
27
28
|
>
|
28
29
|
|
29
30
|
elsif extensible
|
@@ -34,6 +35,7 @@ elsif extensible
|
|
34
35
|
> printf "{{ strings[:invalid_command] }}\n" "$action" >&2
|
35
36
|
> exit 1
|
36
37
|
> fi
|
38
|
+
> ;;
|
37
39
|
>
|
38
40
|
|
39
41
|
else
|
@@ -2,11 +2,11 @@ if default_args.any? or default_flags.any?
|
|
2
2
|
= view_marker
|
3
3
|
|
4
4
|
default_args.each do |arg|
|
5
|
-
> [[ -n ${args[{{ arg.name }}]:-} ]] || args[{{ arg.name }}]="{{ arg.default }}"
|
5
|
+
> [[ -n ${args['{{ arg.name }}']:-} ]] || args['{{ arg.name }}']="{{ arg.default }}"
|
6
6
|
end
|
7
7
|
|
8
8
|
default_flags.each do |flag|
|
9
|
-
> [[ -n ${args[{{ flag.long }}]:-} ]] || args[{{ flag.long }}]="{{ flag.default }}"
|
9
|
+
> [[ -n ${args['{{ flag.long }}']:-} ]] || args['{{ flag.long }}']="{{ flag.default }}"
|
10
10
|
end
|
11
11
|
|
12
12
|
>
|
@@ -4,14 +4,14 @@
|
|
4
4
|
> case "${1:-}" in
|
5
5
|
|
6
6
|
if root_command?
|
7
|
-
= short_flag_exist?("-v") ? "--version)" : "--version | -v)".indent(4)
|
7
|
+
= (short_flag_exist?("-v") ? "--version)" : "--version | -v)").indent(4)
|
8
8
|
> version_command
|
9
9
|
> exit
|
10
10
|
> ;;
|
11
11
|
>
|
12
12
|
end
|
13
13
|
|
14
|
-
= short_flag_exist?("-h") ? "--help)" : "--help | -h)".indent(4)
|
14
|
+
= (short_flag_exist?("-h") ? "--help)" : "--help | -h)").indent(4)
|
15
15
|
> long_usage=yes
|
16
16
|
> <%= function_name %>_usage
|
17
17
|
> exit
|
@@ -3,9 +3,9 @@
|
|
3
3
|
if args.any?
|
4
4
|
condition = "if"
|
5
5
|
args.each do |arg|
|
6
|
-
> {{ condition }} [[ -z ${args[{{ arg.name }}]+x} ]]; then
|
6
|
+
> {{ condition }} [[ -z ${args['{{ arg.name }}']+x} ]]; then
|
7
7
|
= arg.render(:validations).indent 2
|
8
|
-
> args[{{ arg.name }}]=$1
|
8
|
+
> args['{{ arg.name }}']=$1
|
9
9
|
> shift
|
10
10
|
|
11
11
|
condition = "elif"
|
@@ -2,18 +2,17 @@
|
|
2
2
|
|
3
3
|
condition = "if"
|
4
4
|
args.each do |arg|
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
= arg.render(:validations)
|
6
|
+
> {{ condition }} [[ -z ${args['{{ arg.name }}']+x} ]]; then
|
8
7
|
if arg.repeatable
|
9
|
-
> args[{{ arg.name }}]="\"$1\""
|
8
|
+
> args['{{ arg.name }}']="\"$1\""
|
10
9
|
> shift
|
11
10
|
> else
|
12
|
-
> args[{{ arg.name }}]="${args[{{ arg.name }}]} \"$1\""
|
11
|
+
> args['{{ arg.name }}']="${args[{{ arg.name }}]} \"$1\""
|
13
12
|
> shift
|
14
13
|
|
15
14
|
else
|
16
|
-
> args[{{ arg.name }}]=$1
|
15
|
+
> args['{{ arg.name }}']=$1
|
17
16
|
> shift
|
18
17
|
|
19
18
|
end
|
@@ -3,9 +3,9 @@
|
|
3
3
|
if args.any?
|
4
4
|
condition = "if"
|
5
5
|
args.each do |arg|
|
6
|
-
> {{ condition }} [[ -z ${args[{{ arg.name }}]+x} ]]; then
|
6
|
+
> {{ condition }} [[ -z ${args['{{ arg.name }}']+x} ]]; then
|
7
7
|
> {{ arg.render(:validations).indent 2 }}
|
8
|
-
> args[{{ arg.name }}]=$1
|
8
|
+
> args['{{ arg.name }}']=$1
|
9
9
|
> shift
|
10
10
|
|
11
11
|
condition = "elif"
|
@@ -2,7 +2,7 @@ if required_args.any?
|
|
2
2
|
= view_marker
|
3
3
|
|
4
4
|
required_args.each do |arg|
|
5
|
-
> if [[ -z ${args[{{ arg.name }}]+x} ]]; then
|
5
|
+
> if [[ -z ${args['{{ arg.name }}']+x} ]]; then
|
6
6
|
> printf "{{ strings[:missing_required_argument] % { arg: arg.name.upcase, usage: usage_string } }}\n" >&2
|
7
7
|
> exit 1
|
8
8
|
> fi
|
@@ -2,7 +2,7 @@ if required_flags.any?
|
|
2
2
|
= view_marker
|
3
3
|
|
4
4
|
required_flags.each do |flag|
|
5
|
-
> if [[ -z ${args[{{ flag.long }}]+x} ]]; then
|
5
|
+
> if [[ -z ${args['{{ flag.long }}']+x} ]]; then
|
6
6
|
> printf "{{ strings[:missing_required_flag] % { usage: flag.usage_string } }}\n" >&2
|
7
7
|
> exit 1
|
8
8
|
> fi
|
@@ -12,7 +12,7 @@ if whitelisted_args.any? or whitelisted_flags.any?
|
|
12
12
|
> done
|
13
13
|
|
14
14
|
else
|
15
|
-
> if [[ ! ${args[{{ arg.name }}]} =~ ^({{ arg.allowed.join '|' }})$ ]]; then
|
15
|
+
> if [[ ! ${args['{{ arg.name }}']} =~ ^({{ arg.allowed.join '|' }})$ ]]; then
|
16
16
|
> printf "%s\n" "{{ strings[:disallowed_argument] % { name: arg.name, allowed: arg.allowed.join(', ') } }}" >&2
|
17
17
|
> exit 1
|
18
18
|
> fi
|
@@ -31,7 +31,7 @@ if whitelisted_args.any? or whitelisted_flags.any?
|
|
31
31
|
> done
|
32
32
|
|
33
33
|
else
|
34
|
-
> if [[ ! ${args[{{ flag.name }}]} =~ ^({{ flag.allowed.join '|' }})$ ]]; then
|
34
|
+
> if [[ ! ${args['{{ flag.name }}']} =~ ^({{ flag.allowed.join '|' }})$ ]]; then
|
35
35
|
> printf "%s\n" "{{ strings[:disallowed_flag] % { name: flag.name, allowed: flag.allowed.join(', ') } }}" >&2
|
36
36
|
> exit 1
|
37
37
|
> fi
|
@@ -4,14 +4,14 @@
|
|
4
4
|
= render(:validations).indent 2
|
5
5
|
|
6
6
|
if repeatable
|
7
|
-
> if [[ -z ${args[{{ name }}]+x} ]]; then
|
8
|
-
> args[{{ name }}]="\"$2\""
|
7
|
+
> if [[ -z ${args['{{ name }}']+x} ]]; then
|
8
|
+
> args['{{ name }}']="\"$2\""
|
9
9
|
> else
|
10
|
-
> args[{{ name }}]="${args[{{ name }}]} \"$2\""
|
10
|
+
> args['{{ name }}']="${args[{{ name }}]} \"$2\""
|
11
11
|
> fi
|
12
12
|
|
13
13
|
else
|
14
|
-
> args[{{ name }}]="$2"
|
14
|
+
> args['{{ name }}']="$2"
|
15
15
|
|
16
16
|
end
|
17
17
|
|
@@ -3,7 +3,7 @@ if conflicts
|
|
3
3
|
= view_marker
|
4
4
|
|
5
5
|
if conflicts.count == 1
|
6
|
-
> if [[ -n "${args[{{ conflicts.first }}]:-}" ]]; then
|
6
|
+
> if [[ -n "${args['{{ conflicts.first }}']:-}" ]]; then
|
7
7
|
> printf "{{ strings[:conflicting_flags] }}\n" "$key" "{{ conflicts.first }}" >&2
|
8
8
|
> exit 1
|
9
9
|
> fi
|
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: 0.9.
|
4
|
+
version: 0.9.2
|
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: 2022-12-
|
11
|
+
date: 2022-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: completely
|