Add -v argument to use document formatter

This commit is contained in:
Michael Miller 2019-03-03 10:52:15 -07:00
parent a3c4d06e45
commit f338e9b99d

View file

@ -1,3 +1,5 @@
require "option_parser"
module Spectator module Spectator
# Generates configuration from the command-line arguments. # Generates configuration from the command-line arguments.
class CommandLineArgumentsConfigSource < ConfigSource class CommandLineArgumentsConfigSource < ConfigSource
@ -10,7 +12,9 @@ module Spectator
# Applies the specified configuration to a builder. # Applies the specified configuration to a builder.
# Calling this method from multiple sources builds up the final configuration. # Calling this method from multiple sources builds up the final configuration.
def apply_to(builder : ConfigBuilder) : Nil def apply_to(builder : ConfigBuilder) : Nil
# ... OptionParser.parse(@args) do |parser|
parser.on("-v", "--verbose", "Verbose output using document formatter") { builder.formatter = Formatting::DocumentFormatter.new }
end
end end
end end
end end