thor-completion 0.0.0 → 0.0.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 +4 -4
- data/.github/workflows/ruby-tests.yml +2 -3
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +9 -0
- data/lib/thor/completion/builder.rb +7 -6
- data/lib/thor/completion/version.rb +1 -1
- data/thor-completion.gemspec +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c9a09943a60c0fa1ee8dc204e7f1ce67f86683d31651ce15f284c087313c1ce2
|
|
4
|
+
data.tar.gz: 8b82e6ded0bd726a29d701fa71ccaccadda97d76308385b5333766a83a06a66f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3feea415e81693e107ef457275d38207e1f495de6ea439e43a889b23ec7a59ae8f94f2e8329dc77b683e2b0de5adc239ce5384e87a4a849eebabe6358eea5b1f
|
|
7
|
+
data.tar.gz: e339618aa4c8e0a6054178a4d729fa9bcdfe3b898e104671fb3247bf96eac273d6dee2e73b00de156f95e749b810e7a9b9f8858b49d0e793e1990ad9d7725134
|
|
@@ -24,14 +24,13 @@ jobs:
|
|
|
24
24
|
- Gemfile
|
|
25
25
|
|
|
26
26
|
steps:
|
|
27
|
-
- uses: actions/checkout@
|
|
27
|
+
- uses: actions/checkout@v5
|
|
28
28
|
|
|
29
|
-
- uses: actions/cache@
|
|
29
|
+
- uses: actions/cache@v4
|
|
30
30
|
with:
|
|
31
31
|
path: vendor/bundle
|
|
32
32
|
key: >
|
|
33
33
|
${{ runner.os }}-${{ matrix.ruby }}-gems-${{ hashFiles(matrix.gemfile) }}
|
|
34
|
-
|
|
35
34
|
- name: Set up Ruby
|
|
36
35
|
uses: ruby/setup-ruby@v1
|
|
37
36
|
with:
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,15 @@ Prefix your message with one of the following:
|
|
|
11
11
|
- [Security] in case of vulnerabilities.
|
|
12
12
|
-->
|
|
13
13
|
|
|
14
|
+
## v0.0.2
|
|
15
|
+
|
|
16
|
+
- [Fixed] Fix completion property format to match schema (object instead of
|
|
17
|
+
string).
|
|
18
|
+
|
|
19
|
+
## v0.0.1
|
|
20
|
+
|
|
21
|
+
- [Changed] Support ruby 3.3+.
|
|
22
|
+
|
|
14
23
|
## v0.0.0
|
|
15
24
|
|
|
16
25
|
- Initial release.
|
|
@@ -33,7 +33,7 @@ class Thor
|
|
|
33
33
|
cmd_schema = {
|
|
34
34
|
name: command.name,
|
|
35
35
|
description: command.description || "",
|
|
36
|
-
options: command.options.each_value.flat_map { build_option(
|
|
36
|
+
options: command.options.each_value.flat_map { build_option(_1) }
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
# Extract positional arguments from method parameters
|
|
@@ -71,7 +71,7 @@ class Thor
|
|
|
71
71
|
subcmd_schema = {
|
|
72
72
|
name: command.name,
|
|
73
73
|
description: command.description || "",
|
|
74
|
-
options: command.options.each_value.flat_map { build_option(
|
|
74
|
+
options: command.options.each_value.flat_map { build_option(_1) }
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
# Extract positional arguments from method parameters
|
|
@@ -95,9 +95,10 @@ class Thor
|
|
|
95
95
|
end
|
|
96
96
|
|
|
97
97
|
def self.extract_arguments(method)
|
|
98
|
+
opts = %i[req opt rest]
|
|
98
99
|
values = method
|
|
99
100
|
.parameters
|
|
100
|
-
.select {|type, _|
|
|
101
|
+
.select {|type, _| opts.include?(type) } # rubocop:disable Style/HashSlice
|
|
101
102
|
|
|
102
103
|
values.map do |type, name|
|
|
103
104
|
arg_hash = {
|
|
@@ -116,11 +117,11 @@ class Thor
|
|
|
116
117
|
end
|
|
117
118
|
|
|
118
119
|
def self.build_option(option)
|
|
119
|
-
dasherize = proc {
|
|
120
|
+
dasherize = proc { _1.to_s.tr("_", "-") }
|
|
120
121
|
name = dasherize.call(option.name)
|
|
121
122
|
|
|
122
123
|
[].tap do |list|
|
|
123
|
-
short_opts = option.aliases.map { dasherize.call(
|
|
124
|
+
short_opts = option.aliases.map { dasherize.call(_1.gsub(/^-+/, "")) }
|
|
124
125
|
opt_hash = {
|
|
125
126
|
name:,
|
|
126
127
|
type: option.type.to_s,
|
|
@@ -133,7 +134,7 @@ class Thor
|
|
|
133
134
|
}
|
|
134
135
|
|
|
135
136
|
if (completion = resolve_completion(option.name))
|
|
136
|
-
opt_hash[:completion] = completion
|
|
137
|
+
opt_hash[:completion] = {type: completion}
|
|
137
138
|
end
|
|
138
139
|
|
|
139
140
|
# Only add short if there are aliases
|
data/thor-completion.gemspec
CHANGED
|
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
|
12
12
|
spec.summary = "Generate shell completions for Thor CLIs."
|
|
13
13
|
spec.description = spec.summary
|
|
14
14
|
spec.license = "MIT"
|
|
15
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 3.
|
|
15
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 3.3.0")
|
|
16
16
|
|
|
17
17
|
github_url = "https://github.com/fnando/thor-completion"
|
|
18
18
|
github_tree_url = "#{github_url}/tree/v#{spec.version}"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: thor-completion
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nando Vieira
|
|
@@ -165,10 +165,10 @@ metadata:
|
|
|
165
165
|
rubygems_mfa_required: 'true'
|
|
166
166
|
homepage_uri: https://github.com/fnando/thor-completion
|
|
167
167
|
bug_tracker_uri: https://github.com/fnando/thor-completion/issues
|
|
168
|
-
source_code_uri: https://github.com/fnando/thor-completion/tree/v0.0.
|
|
169
|
-
changelog_uri: https://github.com/fnando/thor-completion/tree/v0.0.
|
|
170
|
-
documentation_uri: https://github.com/fnando/thor-completion/tree/v0.0.
|
|
171
|
-
license_uri: https://github.com/fnando/thor-completion/tree/v0.0.
|
|
168
|
+
source_code_uri: https://github.com/fnando/thor-completion/tree/v0.0.2
|
|
169
|
+
changelog_uri: https://github.com/fnando/thor-completion/tree/v0.0.2/CHANGELOG.md
|
|
170
|
+
documentation_uri: https://github.com/fnando/thor-completion/tree/v0.0.2/README.md
|
|
171
|
+
license_uri: https://github.com/fnando/thor-completion/tree/v0.0.2/LICENSE.md
|
|
172
172
|
rdoc_options: []
|
|
173
173
|
require_paths:
|
|
174
174
|
- lib
|
|
@@ -176,7 +176,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
176
176
|
requirements:
|
|
177
177
|
- - ">="
|
|
178
178
|
- !ruby/object:Gem::Version
|
|
179
|
-
version: 3.
|
|
179
|
+
version: 3.3.0
|
|
180
180
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
181
181
|
requirements:
|
|
182
182
|
- - ">="
|