lib/rubysmith/cli/parsers/build.rb in rubysmith-2.0.2 vs lib/rubysmith/cli/parsers/build.rb in rubysmith-3.0.0
- old
+ new
@@ -5,20 +5,22 @@
module Rubysmith
module CLI
module Parsers
# Handles parsing of Command Line Interface (CLI) build options.
class Build
+ include Import[:colorizer]
+
using Refinements::Structs
def self.call(...) = new(...).call
def initialize configuration = Container[:configuration],
client: Parser::CLIENT,
- container: Container
+ **dependencies
+ super(**dependencies)
@configuration = configuration
@client = client
- @container = container
end
def call arguments = []
client.separator "\nBUILD OPTIONS:\n"
collate
@@ -26,11 +28,11 @@
configuration
end
private
- attr_reader :configuration, :client, :container
+ attr_reader :configuration, :client
def collate = private_methods.sort.grep(/add_/).each { |method| __send__ method }
def add_amazing_print
client.on(
@@ -111,19 +113,10 @@
) do |value|
configuration.merge! build_conduct: value
end
end
- def add_dead_end
- client.on(
- "--[no-]dead_end",
- "Add Dead End gem. #{default __method__}."
- ) do |value|
- configuration.merge! build_dead_end: value
- end
- end
-
def add_debug
client.on(
"--[no-]debug",
"Add Debug gem. #{default __method__}."
) do |value|
@@ -298,11 +291,9 @@
.sub("add_", "build_")
.then { |attribute| configuration.public_send attribute }
.then { |boolean| boolean ? colorizer.green(boolean) : colorizer.red(boolean) }
.then { |colored_boolean| "Default: #{colored_boolean}" }
end
-
- def colorizer = container[__method__]
end
end
end
end