bashly 0.8.9 → 0.9.0
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/README.md +7 -0
- data/bin/bashly +2 -2
- data/lib/bashly/cli.rb +2 -3
- data/lib/bashly/commands/add.rb +74 -50
- data/lib/bashly/commands/base.rb +4 -3
- data/lib/bashly/commands/generate.rb +41 -35
- data/lib/bashly/commands/init.rb +10 -9
- data/lib/bashly/commands/preview.rb +4 -4
- data/lib/bashly/commands/validate.rb +8 -7
- data/lib/bashly/concerns/asset_helper.rb +1 -1
- data/lib/bashly/concerns/completions.rb +24 -15
- data/lib/bashly/concerns/renderable.rb +5 -5
- data/lib/bashly/concerns/validation_helpers.rb +20 -12
- data/lib/bashly/config.rb +1 -1
- data/lib/bashly/config_validator.rb +47 -23
- data/lib/bashly/deprecation.rb +9 -7
- data/lib/bashly/exceptions.rb +1 -1
- data/lib/bashly/extensions/array.rb +4 -4
- data/lib/bashly/extensions/file.rb +3 -3
- data/lib/bashly/extensions/string.rb +6 -6
- data/lib/bashly/libraries/base.rb +11 -1
- data/lib/bashly/libraries/completions_function.rb +9 -10
- data/lib/bashly/libraries/completions_script.rb +7 -8
- data/lib/bashly/libraries/completions_yaml.rb +7 -8
- data/lib/bashly/libraries/help.rb +36 -0
- data/lib/bashly/libraries.yml +3 -1
- data/lib/bashly/library.rb +7 -5
- data/lib/bashly/message_strings.rb +1 -1
- data/lib/bashly/refinements/compose_refinements.rb +2 -2
- data/lib/bashly/script/argument.rb +1 -1
- data/lib/bashly/script/base.rb +3 -2
- data/lib/bashly/script/catch_all.rb +6 -4
- data/lib/bashly/script/command.rb +51 -51
- data/lib/bashly/script/environment_variable.rb +5 -5
- data/lib/bashly/script/flag.rb +7 -7
- data/lib/bashly/script/wrapper.rb +5 -4
- data/lib/bashly/settings.rb +4 -5
- data/lib/bashly/templates/help/help_command.sh +30 -0
- data/lib/bashly/templates/lib/colors.sh +2 -2
- data/lib/bashly/templates/lib/config.sh +10 -10
- data/lib/bashly/templates/lib/yaml.sh +9 -9
- data/lib/bashly/templates/test/approvals.bash +36 -12
- data/lib/bashly/templates/test/approve +14 -9
- data/lib/bashly/version.rb +2 -2
- data/lib/bashly/views/command/command_fallback.gtx +2 -2
- data/lib/bashly/views/command/command_filter.gtx +9 -9
- data/lib/bashly/views/command/dependencies_filter.gtx +7 -2
- data/lib/bashly/views/command/fixed_flags_filter.gtx +18 -12
- data/lib/bashly/views/command/inspect_args.gtx +2 -2
- data/lib/bashly/views/command/normalize_input.gtx +1 -1
- data/lib/bashly/views/command/parse_requirements_while.gtx +11 -11
- data/lib/bashly/views/command/run.gtx +14 -13
- data/lib/bashly/views/command/usage_environment_variables.gtx +1 -1
- data/lib/bashly/views/flag/case.gtx +1 -1
- data/lib/bashly/views/flag/case_no_arg.gtx +1 -1
- metadata +10 -8
- data/lib/bashly/libraries/completions.rb +0 -14
data/lib/bashly/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module Bashly
|
2
|
-
VERSION =
|
3
|
-
end
|
2
|
+
VERSION = '0.9.0'
|
3
|
+
end
|
@@ -4,22 +4,22 @@ if commands.any?
|
|
4
4
|
> action=${1:-}
|
5
5
|
>
|
6
6
|
> case $action in
|
7
|
-
>
|
8
|
-
>
|
7
|
+
> -*)
|
8
|
+
> ;;
|
9
9
|
>
|
10
10
|
|
11
11
|
commands.each do |command|
|
12
|
-
>
|
13
|
-
>
|
14
|
-
>
|
15
|
-
>
|
16
|
-
>
|
17
|
-
>
|
12
|
+
> {{ command.aliases.join " | " }})
|
13
|
+
> action="{{ command.name }}"
|
14
|
+
> shift
|
15
|
+
> {{ command.function_name }}_parse_requirements "$@"
|
16
|
+
> shift $#
|
17
|
+
> ;;
|
18
18
|
>
|
19
19
|
|
20
20
|
end
|
21
21
|
|
22
|
-
= render
|
22
|
+
= render(:command_fallback).indent(2)
|
23
23
|
> esac
|
24
24
|
>
|
25
25
|
|
@@ -1,10 +1,15 @@
|
|
1
1
|
if dependencies
|
2
2
|
= view_marker
|
3
3
|
|
4
|
-
dependencies.each do |dependency|
|
5
|
-
> if !
|
4
|
+
dependencies.each do |dependency, message|
|
5
|
+
> if ! command -v {{ dependency }} >/dev/null 2>&1; then
|
6
6
|
> printf "{{ strings[:missing_dependency] % { dependency: dependency } }}\n" >&2
|
7
|
+
if message and !message.empty?
|
8
|
+
> # shellcheck disable=SC2059
|
9
|
+
> printf "{{ message }}\n" >&2
|
10
|
+
end
|
7
11
|
> exit 1
|
8
12
|
> fi
|
13
|
+
>
|
9
14
|
end
|
10
15
|
end
|
@@ -1,27 +1,33 @@
|
|
1
1
|
= view_marker
|
2
2
|
|
3
|
-
>
|
3
|
+
> while [[ $# -gt 0 ]]; do
|
4
|
+
> case "${1:-}" in
|
4
5
|
|
5
6
|
if root_command?
|
6
|
-
= short_flag_exist?("-v") ? "--version
|
7
|
-
>
|
8
|
-
>
|
9
|
-
>
|
7
|
+
= short_flag_exist?("-v") ? "--version)" : "--version | -v)".indent(4)
|
8
|
+
> version_command
|
9
|
+
> exit
|
10
|
+
> ;;
|
10
11
|
>
|
11
12
|
end
|
12
13
|
|
13
|
-
= short_flag_exist?("-h") ? "--help
|
14
|
-
>
|
15
|
-
>
|
16
|
-
>
|
17
|
-
>
|
14
|
+
= short_flag_exist?("-h") ? "--help)" : "--help | -h)".indent(4)
|
15
|
+
> long_usage=yes
|
16
|
+
> <%= function_name %>_usage
|
17
|
+
> exit
|
18
|
+
> ;;
|
18
19
|
>
|
19
20
|
|
20
21
|
if global_flags?
|
21
22
|
flags.each do |flag|
|
22
|
-
= flag.render(:case)
|
23
|
+
= flag.render(:case).indent(4)
|
23
24
|
end
|
24
25
|
end
|
25
26
|
|
26
|
-
>
|
27
|
+
> *)
|
28
|
+
> break
|
29
|
+
> ;;
|
30
|
+
>
|
31
|
+
> esac
|
32
|
+
> done
|
27
33
|
>
|
@@ -2,14 +2,14 @@
|
|
2
2
|
|
3
3
|
> inspect_args() {
|
4
4
|
> readarray -t sorted_keys < <(printf '%s\n' "${!args[@]}" | sort)
|
5
|
-
> if ((
|
5
|
+
> if ((${#args[@]})); then
|
6
6
|
> echo args:
|
7
7
|
> for k in "${sorted_keys[@]}"; do echo "- \${args[$k]} = ${args[$k]}"; done
|
8
8
|
> else
|
9
9
|
> echo args: none
|
10
10
|
> fi
|
11
11
|
>
|
12
|
-
> if ((
|
12
|
+
> if ((${#other_args[@]})); then
|
13
13
|
> echo
|
14
14
|
> echo other_args:
|
15
15
|
> echo "- \${other_args[*]} = ${other_args[*]}"
|
@@ -15,7 +15,7 @@
|
|
15
15
|
if Settings.compact_short_flags
|
16
16
|
> elif [[ $arg =~ ^-([a-zA-Z0-9][a-zA-Z0-9]+)$ ]]; then
|
17
17
|
> flags="${BASH_REMATCH[1]}"
|
18
|
-
> for ((
|
18
|
+
> for ((i = 0; i < ${#flags}; i++)); do
|
19
19
|
> input+=("-${flags:i:1}")
|
20
20
|
> done
|
21
21
|
end
|
@@ -6,29 +6,29 @@
|
|
6
6
|
|
7
7
|
unless global_flags?
|
8
8
|
flags.each do |flag|
|
9
|
-
= flag.render(:case).indent
|
9
|
+
= flag.render(:case).indent(4)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
13
|
>
|
14
|
-
>
|
14
|
+
> -?*)
|
15
15
|
|
16
16
|
if catch_all.enabled?
|
17
|
-
>
|
18
|
-
>
|
19
|
-
>
|
17
|
+
> other_args+=("$1")
|
18
|
+
> shift
|
19
|
+
> ;;
|
20
20
|
|
21
21
|
else
|
22
|
-
>
|
23
|
-
>
|
24
|
-
>
|
22
|
+
> printf "<%= strings[:invalid_flag] %>\n" "$key" >&2
|
23
|
+
> exit 1
|
24
|
+
> ;;
|
25
25
|
|
26
26
|
end
|
27
27
|
|
28
28
|
>
|
29
|
-
>
|
30
|
-
= render(:parse_requirements_case).indent
|
31
|
-
>
|
29
|
+
> *)
|
30
|
+
= render(:parse_requirements_case).indent(6)
|
31
|
+
> ;;
|
32
32
|
>
|
33
33
|
> esac
|
34
34
|
> done
|
@@ -7,22 +7,23 @@
|
|
7
7
|
> normalize_input "$@"
|
8
8
|
> parse_requirements "${input[@]}"
|
9
9
|
>
|
10
|
+
> case "$action" in
|
10
11
|
|
11
|
-
condition = "if"
|
12
12
|
deep_commands.each do |command|
|
13
|
-
>
|
14
|
-
>
|
15
|
-
>
|
16
|
-
>
|
17
|
-
>
|
18
|
-
>
|
19
|
-
>
|
13
|
+
> "{{ command.action_name }}")
|
14
|
+
> if [[ ${args[--help]:-} ]]; then
|
15
|
+
> long_usage=yes
|
16
|
+
> {{ command.function_name }}_usage
|
17
|
+
> else
|
18
|
+
> {{ command.function_name }}_command
|
19
|
+
> fi
|
20
|
+
> ;;
|
20
21
|
>
|
21
|
-
|
22
|
-
condition = "elif"
|
23
22
|
end
|
24
23
|
|
25
|
-
>
|
26
|
-
>
|
27
|
-
>
|
24
|
+
> "root")
|
25
|
+
> root_command
|
26
|
+
> ;;
|
27
|
+
>
|
28
|
+
> esac
|
28
29
|
> }
|
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.
|
4
|
+
version: 0.9.0
|
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-
|
11
|
+
date: 2022-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: completely
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.5.
|
19
|
+
version: 0.5.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.5.
|
26
|
+
version: 0.5.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: gtx
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 0.7.2
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 0.7.2
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: requires
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -139,10 +139,10 @@ files:
|
|
139
139
|
- lib/bashly/extensions/yaml.rb
|
140
140
|
- lib/bashly/libraries.yml
|
141
141
|
- lib/bashly/libraries/base.rb
|
142
|
-
- lib/bashly/libraries/completions.rb
|
143
142
|
- lib/bashly/libraries/completions_function.rb
|
144
143
|
- lib/bashly/libraries/completions_script.rb
|
145
144
|
- lib/bashly/libraries/completions_yaml.rb
|
145
|
+
- lib/bashly/libraries/help.rb
|
146
146
|
- lib/bashly/library.rb
|
147
147
|
- lib/bashly/message_strings.rb
|
148
148
|
- lib/bashly/refinements/compose_refinements.rb
|
@@ -155,6 +155,7 @@ files:
|
|
155
155
|
- lib/bashly/script/wrapper.rb
|
156
156
|
- lib/bashly/settings.rb
|
157
157
|
- lib/bashly/templates/bashly.yml
|
158
|
+
- lib/bashly/templates/help/help_command.sh
|
158
159
|
- lib/bashly/templates/lib/colors.sh
|
159
160
|
- lib/bashly/templates/lib/config.sh
|
160
161
|
- lib/bashly/templates/lib/sample_function.sh
|
@@ -230,6 +231,7 @@ metadata:
|
|
230
231
|
changelog_uri: https://github.com/DannyBen/bashly/blob/master/CHANGELOG.md
|
231
232
|
homepage_uri: https://bashly.dannyb.co/
|
232
233
|
source_code_uri: https://github.com/DannyBen/bashly
|
234
|
+
rubygems_mfa_required: 'true'
|
233
235
|
post_install_message:
|
234
236
|
rdoc_options: []
|
235
237
|
require_paths:
|
@@ -245,7 +247,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
245
247
|
- !ruby/object:Gem::Version
|
246
248
|
version: '0'
|
247
249
|
requirements: []
|
248
|
-
rubygems_version: 3.3.
|
250
|
+
rubygems_version: 3.3.26
|
249
251
|
signing_key:
|
250
252
|
specification_version: 4
|
251
253
|
summary: Bash Command Line Tool Generator
|