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
1 changed files with 5 additions and 1 deletions

View File

@ -1,3 +1,5 @@
require "option_parser"
module Spectator
# Generates configuration from the command-line arguments.
class CommandLineArgumentsConfigSource < ConfigSource
@ -10,7 +12,9 @@ module Spectator
# Applies the specified configuration to a builder.
# Calling this method from multiple sources builds up the final configuration.
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