bashly 0.9.1 → 0.9.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e1139c7453fff329c05879511103b80b6a89a76896a9d0cb3f5cad016d224b15
4
- data.tar.gz: acda8a068081a04a32218be7ddfee8cad1612b3dfafd9e1465170fd9cded32db
3
+ metadata.gz: ebf951958bb0478fb95b88273b87ccb2f297d36b655996b79d16c2ffdb32e773
4
+ data.tar.gz: aa3a9c218e9876fea287f141191baa4d95b40ae8b5569a7418c40911373e43ef
5
5
  SHA512:
6
- metadata.gz: 61247ecd7b928a4babdbf307004424ffa060c567a16b4eb4b062c59e51eb9812f3469981ead958bb4f08aee8cb7ecd86a32a830f6102211012540eac0b878fd4
7
- data.tar.gz: 606e5df99d98e9853ed25a7fd516a807a90f1c40d7f19ac2ab1b8f3388a82919dd59af3b291d8de7b866d88cdcb8b1fec7883bd258b80c04f137b1729e58aca1
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/
@@ -1,3 +1,3 @@
1
1
  module Bashly
2
- VERSION = '0.9.1'
2
+ VERSION = '0.9.2'
3
3
  end
@@ -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
- > {{ condition }} [[ -z ${args[{{ arg.name }}]+x} ]]; then
6
- = arg.render(:validations).indent 2
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
@@ -11,7 +11,7 @@
11
11
 
12
12
  deep_commands.each do |command|
13
13
  > "{{ command.action_name }}")
14
- > if [[ ${args[--help]:-} ]]; then
14
+ > if [[ ${args['--help']:-} ]]; then
15
15
  > long_usage=yes
16
16
  > {{ command.function_name }}_usage
17
17
  > else
@@ -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
 
@@ -1,9 +1,9 @@
1
1
  = view_marker
2
2
 
3
3
  if repeatable
4
- > ((args[<%= name %>]+=1))
4
+ > ((args['<%= name %>'] += 1))
5
5
  else
6
- > args[<%= name %>]=1
6
+ > args['<%= name %>']=1
7
7
  end
8
8
 
9
9
  > shift
@@ -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.1
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-09 00:00:00.000000000 Z
11
+ date: 2022-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: completely