pennyworth 14.2.1 → 15.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/README.adoc +42 -85
- data/lib/pennyworth/cli/actions/encodings.rb +9 -3
- data/lib/pennyworth/cli/actions/git_hub/organization.rb +33 -0
- data/lib/pennyworth/cli/actions/git_hub/user.rb +31 -0
- data/lib/pennyworth/cli/actions/http_statuses.rb +9 -3
- data/lib/pennyworth/cli/actions/ruby_gems.rb +11 -6
- data/lib/pennyworth/cli/actions/standard_errors.rb +9 -3
- data/lib/pennyworth/cli/actions/system/errors.rb +9 -3
- data/lib/pennyworth/cli/actions/system/signals.rb +9 -3
- data/lib/pennyworth/cli/actions/text.rb +9 -3
- data/lib/pennyworth/cli/shell.rb +33 -40
- data/lib/pennyworth/configuration/contract.rb +20 -0
- data/lib/pennyworth/configuration/defaults.yml +8 -38
- data/lib/pennyworth/configuration/{content.rb → model.rb} +3 -15
- data/lib/pennyworth/container.rb +15 -3
- data/lib/pennyworth/inflector.rb +1 -1
- data/lib/pennyworth/models/http_status.rb +0 -1
- data/lib/pennyworth/models/standard_error.rb +0 -1
- data/pennyworth.gemspec +10 -9
- data.tar.gz.sig +0 -0
- metadata +39 -31
- metadata.gz.sig +0 -0
- data/lib/pennyworth/cli/actions/config.rb +0 -33
- data/lib/pennyworth/cli/actions/container.rb +0 -26
- data/lib/pennyworth/cli/actions/git_hub.rb +0 -27
- data/lib/pennyworth/cli/actions/import.rb +0 -11
- data/lib/pennyworth/cli/parser.rb +0 -34
- data/lib/pennyworth/cli/parsers/core.rb +0 -110
- data/lib/pennyworth/cli/parsers/git_hub.rb +0 -53
- data/lib/pennyworth/cli/parsers/ruby_gems.rb +0 -38
- data/lib/pennyworth/configuration/loader.rb +0 -35
data/lib/pennyworth/container.rb
CHANGED
@@ -2,7 +2,9 @@
|
|
2
2
|
|
3
3
|
require "cogger"
|
4
4
|
require "dry/container"
|
5
|
+
require "etcher"
|
5
6
|
require "http"
|
7
|
+
require "runcom"
|
6
8
|
require "spek"
|
7
9
|
|
8
10
|
module Pennyworth
|
@@ -10,11 +12,21 @@ module Pennyworth
|
|
10
12
|
module Container
|
11
13
|
extend Dry::Container::Mixin
|
12
14
|
|
13
|
-
register
|
15
|
+
register :configuration do
|
16
|
+
self[:defaults].add_loader(Etcher::Loaders::YAML.new(self[:xdg_config].active))
|
17
|
+
.then { |registry| Etcher.call registry }
|
18
|
+
end
|
19
|
+
|
20
|
+
register :defaults do
|
21
|
+
Etcher::Registry.new(contract: Configuration::Contract, model: Configuration::Model)
|
22
|
+
.add_loader(Etcher::Loaders::YAML.new(self[:defaults_path]))
|
23
|
+
end
|
24
|
+
|
25
|
+
register(:defaults_path) { Pathname(__dir__).join("configuration/defaults.yml") }
|
26
|
+
register(:xdg_config) { Runcom::Config.new "pennyworth/configuration.yml" }
|
14
27
|
register(:specification) { Spek::Loader.call "#{__dir__}/../../pennyworth.gemspec" }
|
15
|
-
register(:environment) { ENV }
|
16
28
|
register(:kernel) { Kernel }
|
17
29
|
register(:http) { HTTP }
|
18
|
-
register(:logger) { Cogger
|
30
|
+
register(:logger) { Cogger.new formatter: :emoji }
|
19
31
|
end
|
20
32
|
end
|
data/lib/pennyworth/inflector.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
module Pennyworth
|
4
4
|
# Overrides any string to desired form if matched, otherwise answers the original string.
|
5
5
|
class Inflector
|
6
|
-
DEFAULTS = Array(
|
6
|
+
DEFAULTS = Array(Container[:configuration].inflections).reduce({}, :merge)
|
7
7
|
|
8
8
|
def initialize overrides = DEFAULTS
|
9
9
|
@overrides = overrides
|
data/pennyworth.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "pennyworth"
|
5
|
-
spec.version = "
|
5
|
+
spec.version = "15.0.0"
|
6
6
|
spec.authors = ["Brooke Kuhlmann"]
|
7
7
|
spec.email = ["brooke@alchemists.io"]
|
8
8
|
spec.homepage = "https://alchemists.io/projects/pennyworth"
|
9
|
-
spec.summary = "A command line interface
|
9
|
+
spec.summary = "A command line interface for augmenting Alfred workflows."
|
10
10
|
spec.license = "Hippocratic-2.1"
|
11
11
|
|
12
12
|
spec.metadata = {
|
@@ -23,16 +23,17 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.cert_chain = [Gem.default_cert_path]
|
24
24
|
|
25
25
|
spec.required_ruby_version = "~> 3.2"
|
26
|
-
spec.add_dependency "cogger", "~> 0.
|
27
|
-
spec.add_dependency "core", "~> 0.1"
|
26
|
+
spec.add_dependency "cogger", "~> 0.10"
|
28
27
|
spec.add_dependency "dry-container", "~> 0.11"
|
29
|
-
spec.add_dependency "
|
28
|
+
spec.add_dependency "etcher", "~> 0.2"
|
29
|
+
spec.add_dependency "ghub", "~> 0.5"
|
30
30
|
spec.add_dependency "http", "~> 5.1"
|
31
|
-
spec.add_dependency "infusible", "~>
|
31
|
+
spec.add_dependency "infusible", "~> 2.0"
|
32
32
|
spec.add_dependency "rack", "~> 3.0"
|
33
|
-
spec.add_dependency "refinements", "~>
|
34
|
-
spec.add_dependency "runcom", "~>
|
35
|
-
spec.add_dependency "
|
33
|
+
spec.add_dependency "refinements", "~> 11.0"
|
34
|
+
spec.add_dependency "runcom", "~> 10.0"
|
35
|
+
spec.add_dependency "sod", "~> 0.0"
|
36
|
+
spec.add_dependency "spek", "~> 2.0"
|
36
37
|
spec.add_dependency "zeitwerk", "~> 2.6"
|
37
38
|
|
38
39
|
spec.bindir = "exe"
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pennyworth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 15.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke Kuhlmann
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
3n5C8/6Zh9DYTkpcwPSuIfAga6wf4nXc9m6JAw8AuMLaiWN/r/2s4zJsUHYERJEu
|
36
36
|
gZGm4JqtuSg8pYjPeIJxS960owq+SfuC+jxqmRA54BisFCv/0VOJi7tiJVY=
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2023-
|
38
|
+
date: 2023-06-16 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: cogger
|
@@ -43,56 +43,56 @@ dependencies:
|
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '0.
|
46
|
+
version: '0.10'
|
47
47
|
type: :runtime
|
48
48
|
prerelease: false
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '0.
|
53
|
+
version: '0.10'
|
54
54
|
- !ruby/object:Gem::Dependency
|
55
|
-
name:
|
55
|
+
name: dry-container
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '0.
|
60
|
+
version: '0.11'
|
61
61
|
type: :runtime
|
62
62
|
prerelease: false
|
63
63
|
version_requirements: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: '0.
|
67
|
+
version: '0.11'
|
68
68
|
- !ruby/object:Gem::Dependency
|
69
|
-
name:
|
69
|
+
name: etcher
|
70
70
|
requirement: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: '0.
|
74
|
+
version: '0.2'
|
75
75
|
type: :runtime
|
76
76
|
prerelease: false
|
77
77
|
version_requirements: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: '0.
|
81
|
+
version: '0.2'
|
82
82
|
- !ruby/object:Gem::Dependency
|
83
83
|
name: ghub
|
84
84
|
requirement: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: '0.
|
88
|
+
version: '0.5'
|
89
89
|
type: :runtime
|
90
90
|
prerelease: false
|
91
91
|
version_requirements: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
93
|
- - "~>"
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: '0.
|
95
|
+
version: '0.5'
|
96
96
|
- !ruby/object:Gem::Dependency
|
97
97
|
name: http
|
98
98
|
requirement: !ruby/object:Gem::Requirement
|
@@ -113,14 +113,14 @@ dependencies:
|
|
113
113
|
requirements:
|
114
114
|
- - "~>"
|
115
115
|
- !ruby/object:Gem::Version
|
116
|
-
version: '
|
116
|
+
version: '2.0'
|
117
117
|
type: :runtime
|
118
118
|
prerelease: false
|
119
119
|
version_requirements: !ruby/object:Gem::Requirement
|
120
120
|
requirements:
|
121
121
|
- - "~>"
|
122
122
|
- !ruby/object:Gem::Version
|
123
|
-
version: '
|
123
|
+
version: '2.0'
|
124
124
|
- !ruby/object:Gem::Dependency
|
125
125
|
name: rack
|
126
126
|
requirement: !ruby/object:Gem::Requirement
|
@@ -137,6 +137,20 @@ dependencies:
|
|
137
137
|
version: '3.0'
|
138
138
|
- !ruby/object:Gem::Dependency
|
139
139
|
name: refinements
|
140
|
+
requirement: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - "~>"
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '11.0'
|
145
|
+
type: :runtime
|
146
|
+
prerelease: false
|
147
|
+
version_requirements: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - "~>"
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '11.0'
|
152
|
+
- !ruby/object:Gem::Dependency
|
153
|
+
name: runcom
|
140
154
|
requirement: !ruby/object:Gem::Requirement
|
141
155
|
requirements:
|
142
156
|
- - "~>"
|
@@ -150,33 +164,33 @@ dependencies:
|
|
150
164
|
- !ruby/object:Gem::Version
|
151
165
|
version: '10.0'
|
152
166
|
- !ruby/object:Gem::Dependency
|
153
|
-
name:
|
167
|
+
name: sod
|
154
168
|
requirement: !ruby/object:Gem::Requirement
|
155
169
|
requirements:
|
156
170
|
- - "~>"
|
157
171
|
- !ruby/object:Gem::Version
|
158
|
-
version: '
|
172
|
+
version: '0.0'
|
159
173
|
type: :runtime
|
160
174
|
prerelease: false
|
161
175
|
version_requirements: !ruby/object:Gem::Requirement
|
162
176
|
requirements:
|
163
177
|
- - "~>"
|
164
178
|
- !ruby/object:Gem::Version
|
165
|
-
version: '
|
179
|
+
version: '0.0'
|
166
180
|
- !ruby/object:Gem::Dependency
|
167
181
|
name: spek
|
168
182
|
requirement: !ruby/object:Gem::Requirement
|
169
183
|
requirements:
|
170
184
|
- - "~>"
|
171
185
|
- !ruby/object:Gem::Version
|
172
|
-
version: '
|
186
|
+
version: '2.0'
|
173
187
|
type: :runtime
|
174
188
|
prerelease: false
|
175
189
|
version_requirements: !ruby/object:Gem::Requirement
|
176
190
|
requirements:
|
177
191
|
- - "~>"
|
178
192
|
- !ruby/object:Gem::Version
|
179
|
-
version: '
|
193
|
+
version: '2.0'
|
180
194
|
- !ruby/object:Gem::Dependency
|
181
195
|
name: zeitwerk
|
182
196
|
requirement: !ruby/object:Gem::Requirement
|
@@ -205,25 +219,19 @@ files:
|
|
205
219
|
- README.adoc
|
206
220
|
- exe/pennyworth
|
207
221
|
- lib/pennyworth.rb
|
208
|
-
- lib/pennyworth/cli/actions/config.rb
|
209
|
-
- lib/pennyworth/cli/actions/container.rb
|
210
222
|
- lib/pennyworth/cli/actions/encodings.rb
|
211
|
-
- lib/pennyworth/cli/actions/git_hub.rb
|
223
|
+
- lib/pennyworth/cli/actions/git_hub/organization.rb
|
224
|
+
- lib/pennyworth/cli/actions/git_hub/user.rb
|
212
225
|
- lib/pennyworth/cli/actions/http_statuses.rb
|
213
|
-
- lib/pennyworth/cli/actions/import.rb
|
214
226
|
- lib/pennyworth/cli/actions/ruby_gems.rb
|
215
227
|
- lib/pennyworth/cli/actions/standard_errors.rb
|
216
228
|
- lib/pennyworth/cli/actions/system/errors.rb
|
217
229
|
- lib/pennyworth/cli/actions/system/signals.rb
|
218
230
|
- lib/pennyworth/cli/actions/text.rb
|
219
|
-
- lib/pennyworth/cli/parser.rb
|
220
|
-
- lib/pennyworth/cli/parsers/core.rb
|
221
|
-
- lib/pennyworth/cli/parsers/git_hub.rb
|
222
|
-
- lib/pennyworth/cli/parsers/ruby_gems.rb
|
223
231
|
- lib/pennyworth/cli/shell.rb
|
224
|
-
- lib/pennyworth/configuration/
|
232
|
+
- lib/pennyworth/configuration/contract.rb
|
225
233
|
- lib/pennyworth/configuration/defaults.yml
|
226
|
-
- lib/pennyworth/configuration/
|
234
|
+
- lib/pennyworth/configuration/model.rb
|
227
235
|
- lib/pennyworth/container.rb
|
228
236
|
- lib/pennyworth/import.rb
|
229
237
|
- lib/pennyworth/inflector.rb
|
@@ -285,8 +293,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
285
293
|
- !ruby/object:Gem::Version
|
286
294
|
version: '0'
|
287
295
|
requirements: []
|
288
|
-
rubygems_version: 3.4.
|
296
|
+
rubygems_version: 3.4.14
|
289
297
|
signing_key:
|
290
298
|
specification_version: 4
|
291
|
-
summary: A command line interface
|
299
|
+
summary: A command line interface for augmenting Alfred workflows.
|
292
300
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|
@@ -1,33 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Pennyworth
|
4
|
-
module CLI
|
5
|
-
module Actions
|
6
|
-
# Handles the configuration action.
|
7
|
-
class Config
|
8
|
-
include Pennyworth::Import[:kernel, :logger]
|
9
|
-
|
10
|
-
def initialize(configuration: Configuration::Loader::CLIENT, **)
|
11
|
-
super(**)
|
12
|
-
@configuration = configuration
|
13
|
-
end
|
14
|
-
|
15
|
-
def call action
|
16
|
-
case action
|
17
|
-
when :edit then edit
|
18
|
-
when :view then view
|
19
|
-
else logger.error { "Invalid configuration action: #{action}." }
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
private
|
24
|
-
|
25
|
-
attr_reader :configuration
|
26
|
-
|
27
|
-
def edit = kernel.system("$EDITOR #{configuration.current}")
|
28
|
-
|
29
|
-
def view = kernel.system("cat #{configuration.current}")
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "dry/container"
|
4
|
-
|
5
|
-
module Pennyworth
|
6
|
-
module CLI
|
7
|
-
module Actions
|
8
|
-
# Provides a single container with application and action specific dependencies.
|
9
|
-
module Container
|
10
|
-
extend Dry::Container::Mixin
|
11
|
-
|
12
|
-
merge Pennyworth::Container
|
13
|
-
|
14
|
-
register(:config) { Config.new }
|
15
|
-
register(:encodings) { Encodings.new }
|
16
|
-
register(:git_hub) { GitHub.new }
|
17
|
-
register(:http_statuses) { HTTPStatuses.new }
|
18
|
-
register(:ruby_gems) { RubyGems.new }
|
19
|
-
register(:standard_errors) { StandardErrors.new }
|
20
|
-
register(:system_errors) { System::Errors.new }
|
21
|
-
register(:system_signals) { System::Signals.new }
|
22
|
-
register(:text) { Text.new }
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Pennyworth
|
4
|
-
module CLI
|
5
|
-
module Actions
|
6
|
-
# Handles the GitHub action.
|
7
|
-
class GitHub
|
8
|
-
include Pennyworth::Import[:logger]
|
9
|
-
|
10
|
-
def initialize(processor: Processor.for_projects, **)
|
11
|
-
super(**)
|
12
|
-
@processor = processor
|
13
|
-
end
|
14
|
-
|
15
|
-
def call endpoint
|
16
|
-
processor.call(endpoint)
|
17
|
-
.to_json
|
18
|
-
.then { |json| logger.info { json } }
|
19
|
-
end
|
20
|
-
|
21
|
-
private
|
22
|
-
|
23
|
-
attr_reader :processor
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "core"
|
4
|
-
require "optparse"
|
5
|
-
|
6
|
-
module Pennyworth
|
7
|
-
module CLI
|
8
|
-
# Assembles and parses all Command Line Interface (CLI) options.
|
9
|
-
class Parser
|
10
|
-
CLIENT = OptionParser.new nil, 40, " "
|
11
|
-
SECTIONS = [Parsers::Core, Parsers::GitHub, Parsers::RubyGems].freeze # Order is important.
|
12
|
-
|
13
|
-
def initialize configuration = Container[:configuration],
|
14
|
-
sections: SECTIONS,
|
15
|
-
client: CLIENT
|
16
|
-
@configuration_duplicate = configuration.dup
|
17
|
-
@sections = sections
|
18
|
-
@client = client
|
19
|
-
end
|
20
|
-
|
21
|
-
def call arguments = Core::EMPTY_ARRAY
|
22
|
-
sections.each { |parser| parser.call configuration_duplicate, client: }
|
23
|
-
client.parse arguments
|
24
|
-
configuration_duplicate.freeze
|
25
|
-
end
|
26
|
-
|
27
|
-
def to_s = client.to_s
|
28
|
-
|
29
|
-
private
|
30
|
-
|
31
|
-
attr_reader :configuration_duplicate, :client, :sections
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1,110 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "core"
|
4
|
-
require "refinements/structs"
|
5
|
-
|
6
|
-
module Pennyworth
|
7
|
-
module CLI
|
8
|
-
module Parsers
|
9
|
-
# Handles parsing of Command Line Interface (CLI) core options.
|
10
|
-
class Core
|
11
|
-
include Import[:specification]
|
12
|
-
|
13
|
-
using Refinements::Structs
|
14
|
-
|
15
|
-
def self.call(...) = new(...).call
|
16
|
-
|
17
|
-
def initialize(configuration = Container[:configuration], client: Parser::CLIENT, **)
|
18
|
-
super(**)
|
19
|
-
@configuration = configuration
|
20
|
-
@client = client
|
21
|
-
end
|
22
|
-
|
23
|
-
def call arguments = ::Core::EMPTY_ARRAY
|
24
|
-
client.banner = specification.labeled_summary
|
25
|
-
client.separator "\nUSAGE:\n"
|
26
|
-
collate
|
27
|
-
client.parse arguments
|
28
|
-
configuration
|
29
|
-
end
|
30
|
-
|
31
|
-
private
|
32
|
-
|
33
|
-
attr_reader :configuration, :client
|
34
|
-
|
35
|
-
def collate = private_methods.sort.grep(/add_/).each { |method| __send__ method }
|
36
|
-
|
37
|
-
def add_config
|
38
|
-
client.on(
|
39
|
-
"-c",
|
40
|
-
"--config ACTION",
|
41
|
-
%i[edit view],
|
42
|
-
"Manage gem configuration. Actions: edit || view."
|
43
|
-
) do |action|
|
44
|
-
configuration.action_config = action
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
def add_encodings
|
49
|
-
client.on "--encodings", "Render Alfred encodings script filter." do
|
50
|
-
configuration.action_encodings = true
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
def add_git_hub
|
55
|
-
client.on "--git_hub", "Render Alfred GitHub repositories script filter." do
|
56
|
-
configuration.action_git_hub = true
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def add_http_statuses
|
61
|
-
client.on "--http_statuses", "Render Alfred HTTP statuses script filter." do
|
62
|
-
configuration.action_http_statuses = true
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
def add_ruby_gems
|
67
|
-
client.on "--ruby_gems", "Render Alfred RubyGems script filter." do
|
68
|
-
configuration.action_ruby_gems = true
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
def add_standard_errors
|
73
|
-
client.on "--standard_errors", "Render Alfred standard errors script filter." do
|
74
|
-
configuration.action_standard_errors = true
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
def add_system_errors
|
79
|
-
client.on "--system_errors", "Render Alfred system errors script filter." do
|
80
|
-
configuration.action_system_errors = true
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
def add_system_signals
|
85
|
-
client.on "--system_signals", "Render Alfred system signals script filter." do
|
86
|
-
configuration.action_system_signals = true
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
def add_text
|
91
|
-
client.on "--text CONTENT", "Render Alfred text script filter." do |content|
|
92
|
-
configuration.action_text = content
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
def add_version
|
97
|
-
client.on "-v", "--version", "Show gem version." do
|
98
|
-
configuration.action_version = true
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
def add_help
|
103
|
-
client.on "-h", "--help", "Show this message." do
|
104
|
-
configuration.action_help = true
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "core"
|
4
|
-
require "refinements/structs"
|
5
|
-
|
6
|
-
module Pennyworth
|
7
|
-
module CLI
|
8
|
-
module Parsers
|
9
|
-
# Handles parsing of Command Line Interface (CLI) GitHub options.
|
10
|
-
class GitHub
|
11
|
-
using Refinements::Structs
|
12
|
-
|
13
|
-
def self.call(...) = new(...).call
|
14
|
-
|
15
|
-
def initialize configuration = Container[:configuration], client: Parser::CLIENT
|
16
|
-
@configuration = configuration
|
17
|
-
@client = client
|
18
|
-
end
|
19
|
-
|
20
|
-
def call arguments = ::Core::EMPTY_ARRAY
|
21
|
-
client.separator "\nGITHUB OPTIONS:\n"
|
22
|
-
private_methods.sort.grep(/add_/).each { |method| __send__ method }
|
23
|
-
client.parse arguments
|
24
|
-
configuration
|
25
|
-
end
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
attr_reader :configuration, :client
|
30
|
-
|
31
|
-
def add_organization
|
32
|
-
client.on(
|
33
|
-
"--organization [HANDLE]",
|
34
|
-
%(Set organization. Default: "#{organization}".)
|
35
|
-
) do |handle|
|
36
|
-
configuration.merge! action_git_hub: :organization,
|
37
|
-
git_hub_organization: handle || organization
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
def add_user
|
42
|
-
client.on "--user [HANDLE]", %(Set user. Default: "#{user}".) do |handle|
|
43
|
-
configuration.merge! action_git_hub: :user, git_hub_user: handle || user
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def organization = configuration.git_hub_organization
|
48
|
-
|
49
|
-
def user = configuration.git_hub_user
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "core"
|
4
|
-
|
5
|
-
module Pennyworth
|
6
|
-
module CLI
|
7
|
-
module Parsers
|
8
|
-
# Handles parsing of Command Line Interface (CLI) RubyGems options.
|
9
|
-
class RubyGems
|
10
|
-
def self.call(...) = new(...).call
|
11
|
-
|
12
|
-
def initialize configuration = Container[:configuration], client: Parser::CLIENT
|
13
|
-
@configuration = configuration
|
14
|
-
@client = client
|
15
|
-
end
|
16
|
-
|
17
|
-
def call arguments = ::Core::EMPTY_ARRAY
|
18
|
-
client.separator "\nRUBYGEMS OPTIONS:\n"
|
19
|
-
add_owner
|
20
|
-
client.parse arguments
|
21
|
-
configuration
|
22
|
-
end
|
23
|
-
|
24
|
-
private
|
25
|
-
|
26
|
-
attr_reader :configuration, :client
|
27
|
-
|
28
|
-
def add_owner
|
29
|
-
client.on "--owner [HANDLE]", %(Set owner. Default: "#{owner}".) do |handle|
|
30
|
-
configuration.ruby_gems_owner = handle || owner
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def owner = configuration.ruby_gems_owner
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "pathname"
|
4
|
-
require "refinements/hashes"
|
5
|
-
require "refinements/structs"
|
6
|
-
require "runcom"
|
7
|
-
require "yaml"
|
8
|
-
|
9
|
-
module Pennyworth
|
10
|
-
module Configuration
|
11
|
-
# Represents the fully assembled Command Line Interface (CLI) configuration.
|
12
|
-
class Loader
|
13
|
-
using Refinements::Hashes
|
14
|
-
using Refinements::Structs
|
15
|
-
|
16
|
-
DEFAULTS = YAML.load_file(Pathname(__dir__).join("defaults.yml")).freeze
|
17
|
-
CLIENT = Runcom::Config.new "pennyworth/configuration.yml", defaults: DEFAULTS
|
18
|
-
|
19
|
-
def self.call = new.call
|
20
|
-
|
21
|
-
def self.with_defaults = new(client: DEFAULTS)
|
22
|
-
|
23
|
-
def initialize content: Content.new, client: CLIENT
|
24
|
-
@content = content
|
25
|
-
@client = client
|
26
|
-
end
|
27
|
-
|
28
|
-
def call = content.merge(**client.to_h.flatten_keys)
|
29
|
-
|
30
|
-
private
|
31
|
-
|
32
|
-
attr_reader :content, :client
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|