command_kit 0.5.4 → 0.5.6
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/.rubocop.yml +3 -0
- data/ChangeLog.md +24 -0
- data/lib/command_kit/inflector.rb +2 -0
- data/lib/command_kit/interactive.rb +2 -2
- data/lib/command_kit/options.rb +9 -8
- data/lib/command_kit/printing/indent.rb +4 -3
- data/lib/command_kit/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22cdb1135f132682db99b624f27bc5cfbadb51fb988c6c5751210d9e4da994c3
|
4
|
+
data.tar.gz: c01856011175c54fed46b0ab6663cb63eeb125de18767529ffc05b9ea3045d9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d12c2d1904405af1fff0e36b3d73ab3c897d47057f6f71a6db8e34b6aa4419673c0e2b4a6bec2f9cefd4f90bd72be4c86b4e44d9e82912776f14691ffecbcd82
|
7
|
+
data.tar.gz: 349d3f009628535477976b63ce42a23ce30765592663b5ec76f0c07e3530edc723c2cad32441ec9c9559241825913e9afaad37822c64918b7985e3b6579703ff
|
data/.rubocop.yml
CHANGED
@@ -161,3 +161,6 @@ Naming/HeredocDelimiterNaming: { Enabled: false }
|
|
161
161
|
|
162
162
|
# I prefer to use explicit parenthesis for compound logical statements
|
163
163
|
Style/RedundantParentheses: { Enabled: false }
|
164
|
+
|
165
|
+
# I prefer to call `super()` with explicit arguments
|
166
|
+
Style/SuperArguments: { Enabled: false }
|
data/ChangeLog.md
CHANGED
@@ -1,3 +1,27 @@
|
|
1
|
+
### 0.5.6 / 2024-06-19
|
2
|
+
|
3
|
+
#### CommandKit::Inflector
|
4
|
+
|
5
|
+
* Fixed {CommandKit::Inflector.camelize} to convert `foo-1234-5678` to
|
6
|
+
`Foo_1234_5678`.
|
7
|
+
|
8
|
+
#### CommandKit::Printing::Indent
|
9
|
+
|
10
|
+
* Micro-optimization to {CommandKit::Printing::Indent#puts}.
|
11
|
+
|
12
|
+
### 0.5.5 / 2024-04-08
|
13
|
+
|
14
|
+
#### CommandKit::Interactive
|
15
|
+
|
16
|
+
* Ensure that the interactive prompt is re-printed when no input is entered
|
17
|
+
and input is required from the user.
|
18
|
+
|
19
|
+
#### CommandKit::Options
|
20
|
+
|
21
|
+
* Do not pass an Array of Regexp captures for an option's value Regexp type
|
22
|
+
into an option's block, if the option's block only accepts one argument.
|
23
|
+
Instead, only pass the option's value as a String.
|
24
|
+
|
1
25
|
### 0.5.4 / 2024-03-14
|
2
26
|
|
3
27
|
#### CommandKit::Options
|
@@ -101,6 +101,8 @@ module CommandKit
|
|
101
101
|
if (word = scanner.scan(/[A-Za-z\d]+/))
|
102
102
|
word.capitalize!
|
103
103
|
new_string << word
|
104
|
+
elsif (numbers = scanner.scan(/[_-]\d+/))
|
105
|
+
new_string << "_#{numbers[1..]}"
|
104
106
|
elsif scanner.scan(/[_-]+/)
|
105
107
|
# skip
|
106
108
|
elsif scanner.scan(%r{/})
|
data/lib/command_kit/options.rb
CHANGED
@@ -307,15 +307,16 @@ module CommandKit
|
|
307
307
|
end
|
308
308
|
|
309
309
|
option_parser.on(*option.usage,option.type,*option.desc) do |value|
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
310
|
+
if option.type.is_a?(Regexp) && value.is_a?(Array)
|
311
|
+
# separate the optiona value from the additional Regexp captures
|
312
|
+
value, *args = value
|
313
|
+
else
|
314
|
+
args = nil
|
315
|
+
end
|
316
316
|
|
317
|
-
|
318
|
-
|
317
|
+
@options[option.name] = value
|
318
|
+
instance_exec(value,*args,&option.block) if option.block
|
319
|
+
end
|
319
320
|
end
|
320
321
|
end
|
321
322
|
end
|
@@ -26,6 +26,7 @@ module CommandKit
|
|
26
26
|
#
|
27
27
|
def initialize(**kwargs)
|
28
28
|
@indent = 0
|
29
|
+
@indent_padding = String.new
|
29
30
|
|
30
31
|
super(**kwargs)
|
31
32
|
end
|
@@ -71,8 +72,10 @@ module CommandKit
|
|
71
72
|
|
72
73
|
begin
|
73
74
|
@indent += n
|
75
|
+
@indent_padding << (' ' * n)
|
74
76
|
yield
|
75
77
|
ensure
|
78
|
+
@indent_padding.slice!(original_indent,n)
|
76
79
|
@indent = original_indent
|
77
80
|
end
|
78
81
|
else
|
@@ -90,9 +93,7 @@ module CommandKit
|
|
90
93
|
#
|
91
94
|
def puts(*lines)
|
92
95
|
if (@indent > 0 && !lines.empty?)
|
93
|
-
|
94
|
-
|
95
|
-
super(*lines.map { |line| "#{padding}#{line}" })
|
96
|
+
super(*lines.map { |line| "#{@indent_padding}#{line}" })
|
96
97
|
else
|
97
98
|
super(*lines)
|
98
99
|
end
|
data/lib/command_kit/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: command_kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Postmodern
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: '0'
|
146
146
|
requirements: []
|
147
|
-
rubygems_version: 3.
|
147
|
+
rubygems_version: 3.5.9
|
148
148
|
signing_key:
|
149
149
|
specification_version: 4
|
150
150
|
summary: An all-in-one modular Ruby CLI toolkit
|