bashly 1.0.2 → 1.0.3
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 -2
- data/lib/bashly/commands/doc.rb +1 -1
- data/lib/bashly/commands/generate.rb +1 -4
- data/lib/bashly/config_validator.rb +10 -10
- data/lib/bashly/libraries/hooks/initialize.sh +6 -0
- data/lib/bashly/libraries/libraries.yml +3 -1
- data/lib/bashly/script/command.rb +1 -1
- data/lib/bashly/version.rb +1 -1
- data/lib/bashly/views/command/default_assignments.gtx +1 -1
- data/lib/bashly/views/command/environment_variables_default.gtx +1 -1
- data/lib/bashly/views/command/initialize.gtx +5 -2
- data/lib/bashly/views/command/required_flags_filter.gtx +1 -1
- data/lib/bashly/views/command/whitelist_filter.gtx +2 -2
- metadata +5 -5
- data/lib/bashly/views/command/default_initialize_script.gtx +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b90c79b66c9396dc7fda026e19761818e7db33c8b19b0e0501486b3cdf7f1e0
|
4
|
+
data.tar.gz: be2b5e3ae996189263e604421910ebc3b8a597e3cf9c525cf19b94e2e4434fd3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1414d602e5fabf5e9b98dfb1811276601f01de83dc0c866ce155ab22a2246122c9a6a2605c9f83dedc70f21a47c5f397b5ed59339412d8eccf09a319429b7271
|
7
|
+
data.tar.gz: 8bef6713c24b2a2d24d0ef97b54c1fd957ad8ff28e041ec08fdfa96c3bedc22a5a41c6b4691367357e63e404ba87dbd9599d7eddd0102cbe9bac9184f0d1dcee
|
data/README.md
CHANGED
@@ -29,7 +29,12 @@ a [docker image](https://hub.docker.com/r/dannyben/bashly).
|
|
29
29
|
|
30
30
|
## Bashly is Sponsored By
|
31
31
|
|
32
|
-
<
|
32
|
+
<table>
|
33
|
+
<tr>
|
34
|
+
<td><a href="https://rhodecode.com/"><img src='support/img/RhodeCode-logo.png' width=240></a></td>
|
35
|
+
<td><a href="https://decisiohealth.com/"><img src='support/img/decisio-logo.png' width=240></a></td>
|
36
|
+
</tr>
|
37
|
+
</table>
|
33
38
|
|
34
39
|
|
35
40
|
## Documentation
|
@@ -69,7 +74,7 @@ Bashly is responsible for:
|
|
69
74
|
- **Bash completions**.
|
70
75
|
- and more.
|
71
76
|
|
72
|
-
|
77
|
+
## Contributing / Support
|
73
78
|
|
74
79
|
If you experience any issue, have a question or a suggestion, or if you wish
|
75
80
|
to contribute, feel free to [open an issue][issues] or
|
data/lib/bashly/commands/doc.rb
CHANGED
@@ -89,7 +89,7 @@ module Bashly
|
|
89
89
|
end
|
90
90
|
|
91
91
|
def generated_files
|
92
|
-
Dir["#{Settings.source_dir}/**/*.*"]
|
92
|
+
Dir["#{Settings.source_dir}/**/*.*"]
|
93
93
|
end
|
94
94
|
|
95
95
|
def upgrade(existing_file, library_name, *args)
|
@@ -125,9 +125,6 @@ module Bashly
|
|
125
125
|
def create_user_files
|
126
126
|
quiet_say "creating user files in g`#{Settings.source_dir}`"
|
127
127
|
|
128
|
-
create_file "#{Settings.source_dir}/initialize.#{Settings.partials_extension}",
|
129
|
-
command.render(:default_initialize_script)
|
130
|
-
|
131
128
|
if command.commands.empty?
|
132
129
|
create_root_command_file
|
133
130
|
else
|
@@ -100,14 +100,14 @@ module Bashly
|
|
100
100
|
|
101
101
|
refute value['name'].match(/^-/), "#{key}.name must not start with '-'"
|
102
102
|
|
103
|
-
refute value['required'] && value['default'], "#{key} cannot have both required and default"
|
103
|
+
refute value['required'] && value['default'], "#{key} cannot have both nub`required` and nub`default`"
|
104
104
|
end
|
105
105
|
|
106
106
|
def assert_flag(key, value)
|
107
107
|
assert_hash key, value, keys: Script::Flag.option_keys
|
108
|
-
assert value['short'] || value['long'], "#{key} must have at least one of long or short
|
108
|
+
assert value['short'] || value['long'], "#{key} must have at least one of nub`long` or nub`short`"
|
109
109
|
|
110
|
-
refute value['allowed'] && value['completions'], "#{key} cannot have both allowed and completions"
|
110
|
+
refute value['allowed'] && value['completions'], "#{key} cannot have both nub`allowed` and nub`completions`"
|
111
111
|
|
112
112
|
assert_optional_string "#{key}.long", value['long']
|
113
113
|
assert_optional_string "#{key}.short", value['short']
|
@@ -127,18 +127,18 @@ module Bashly
|
|
127
127
|
assert value['short'].match(/^-[a-zA-Z0-9]$/), "#{key}.short must be in the form of '-n'" if value['short']
|
128
128
|
refute value['arg'].match(/^-/), "#{key}.arg must not start with '-'" if value['arg']
|
129
129
|
|
130
|
-
refute value['required'] && value['default'], "#{key} cannot have both required and default"
|
130
|
+
refute value['required'] && value['default'], "#{key} cannot have both nub`required` and nub`default`"
|
131
131
|
|
132
132
|
if value['default']
|
133
|
-
assert value['arg'], "#{key}.default does not make sense without arg"
|
133
|
+
assert value['arg'], "#{key}.default does not make sense without nub`arg`"
|
134
134
|
end
|
135
135
|
|
136
136
|
if value['allowed']
|
137
|
-
assert value['arg'], "#{key}.allowed does not make sense without arg"
|
137
|
+
assert value['arg'], "#{key}.allowed does not make sense without nub`arg`"
|
138
138
|
end
|
139
139
|
|
140
140
|
if value['completions']
|
141
|
-
assert value['arg'], "#{key}.completions does not make sense without arg"
|
141
|
+
assert value['arg'], "#{key}.completions does not make sense without nub`arg`"
|
142
142
|
end
|
143
143
|
end
|
144
144
|
|
@@ -154,8 +154,8 @@ module Bashly
|
|
154
154
|
def assert_command(key, value)
|
155
155
|
assert_hash key, value, keys: Script::Command.option_keys
|
156
156
|
|
157
|
-
refute value['commands'] && value['args'], "#{key} cannot have both commands and args"
|
158
|
-
refute value['commands'] && value['catch_all'], "#{key} cannot have both commands and catch_all"
|
157
|
+
refute value['commands'] && value['args'], "#{key} cannot have both nub`commands` and nub`args`"
|
158
|
+
refute value['commands'] && value['catch_all'], "#{key} cannot have both nub`commands` and nub`catch_all`"
|
159
159
|
|
160
160
|
assert_string "#{key}.name", value['name']
|
161
161
|
assert_optional_string "#{key}.help", value['help']
|
@@ -202,7 +202,7 @@ module Bashly
|
|
202
202
|
end
|
203
203
|
|
204
204
|
if value['expose']
|
205
|
-
assert value['commands'], "#{key}.expose makes no sense without commands"
|
205
|
+
assert value['commands'], "#{key}.expose makes no sense without nub`commands`"
|
206
206
|
end
|
207
207
|
|
208
208
|
if key == 'root'
|
@@ -30,8 +30,10 @@ help:
|
|
30
30
|
handler: Bashly::Libraries::Help
|
31
31
|
|
32
32
|
hooks:
|
33
|
-
help: Add placeholders for before/after hooks which are executed before/after any command.
|
33
|
+
help: Add placeholders for initialize/before/after hooks which are executed on script initialization, and before/after any command.
|
34
34
|
files:
|
35
|
+
- source: "hooks/initialize.sh"
|
36
|
+
target: "%{user_source_dir}/initialize.%{user_ext}"
|
35
37
|
- source: "hooks/before.sh"
|
36
38
|
target: "%{user_source_dir}/before.%{user_ext}"
|
37
39
|
- source: "hooks/after.sh"
|
@@ -297,7 +297,7 @@ module Bashly
|
|
297
297
|
# This is meant to provide the user with the ability to add custom
|
298
298
|
# functions
|
299
299
|
def user_lib
|
300
|
-
@user_lib ||= Dir["#{Settings.full_lib_dir}/**/*.#{Settings.partials_extension}"]
|
300
|
+
@user_lib ||= Dir["#{Settings.full_lib_dir}/**/*.#{Settings.partials_extension}"]
|
301
301
|
end
|
302
302
|
|
303
303
|
# Returns an array of all the args with a whitelist
|
data/lib/bashly/version.rb
CHANGED
@@ -6,7 +6,7 @@ if default_args.any? or default_flags.any?
|
|
6
6
|
end
|
7
7
|
|
8
8
|
default_flags.each do |flag|
|
9
|
-
> [[ -n ${args['{{ flag.
|
9
|
+
> [[ -n ${args['{{ flag.name }}']:-} ]] || args['{{ flag.name }}']="{{ flag.default }}"
|
10
10
|
end
|
11
11
|
|
12
12
|
>
|
@@ -4,13 +4,16 @@
|
|
4
4
|
> version="<%= version %>"
|
5
5
|
> long_usage=''
|
6
6
|
> {{ Settings.strict_string }}
|
7
|
-
>
|
8
7
|
|
9
8
|
if root_command?
|
9
|
+
>
|
10
10
|
= render(:environment_variables_default).indent 2
|
11
11
|
end
|
12
12
|
|
13
|
-
|
13
|
+
if user_file_exist?('initialize')
|
14
|
+
>
|
15
|
+
= load_user_file('initialize').indent 2
|
16
|
+
end
|
14
17
|
|
15
18
|
> }
|
16
19
|
>
|
@@ -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.
|
5
|
+
> if [[ -z ${args['{{ flag.name }}']+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 [[ -n ${args['{{ arg.name }}']} ]] && [[ ! ${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 }}']} ]] && [[ ! ${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
|
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.0.
|
4
|
+
version: 1.0.3
|
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: 2023-
|
11
|
+
date: 2023-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colsole
|
@@ -157,6 +157,7 @@ files:
|
|
157
157
|
- lib/bashly/libraries/help/help_command.sh
|
158
158
|
- lib/bashly/libraries/hooks/after.sh
|
159
159
|
- lib/bashly/libraries/hooks/before.sh
|
160
|
+
- lib/bashly/libraries/hooks/initialize.sh
|
160
161
|
- lib/bashly/libraries/lib/sample_function.sh
|
161
162
|
- lib/bashly/libraries/libraries.yml
|
162
163
|
- lib/bashly/libraries/settings/settings.yml
|
@@ -192,7 +193,6 @@ files:
|
|
192
193
|
- lib/bashly/views/command/command_filter.gtx
|
193
194
|
- lib/bashly/views/command/command_functions.gtx
|
194
195
|
- lib/bashly/views/command/default_assignments.gtx
|
195
|
-
- lib/bashly/views/command/default_initialize_script.gtx
|
196
196
|
- lib/bashly/views/command/default_root_script.gtx
|
197
197
|
- lib/bashly/views/command/default_script.gtx
|
198
198
|
- lib/bashly/views/command/dependencies_filter.gtx
|
@@ -255,14 +255,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
255
255
|
requirements:
|
256
256
|
- - ">="
|
257
257
|
- !ruby/object:Gem::Version
|
258
|
-
version:
|
258
|
+
version: '3.0'
|
259
259
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
260
260
|
requirements:
|
261
261
|
- - ">="
|
262
262
|
- !ruby/object:Gem::Version
|
263
263
|
version: '0'
|
264
264
|
requirements: []
|
265
|
-
rubygems_version: 3.4.
|
265
|
+
rubygems_version: 3.4.10
|
266
266
|
signing_key:
|
267
267
|
specification_version: 4
|
268
268
|
summary: Bash Command Line Tool Generator
|