3
0

read-spec tool

This commit is contained in:
Philippe Pittoli 2021-03-01 16:06:35 +01:00
parent 2906e03ff7
commit feeed2306c

27
read-spec.cr Normal file
View File

@ -0,0 +1,27 @@
require "option_parser"
require "colorize"
require "./src/specparser"
recipe_file_name = "some-non-existant-file"
OptionParser.parse do |parser|
parser.on "-f file", "--file file", "File to parse." do |f|
recipe_file_name = f
end
parser.on "-h", "--help", "Show this help" do
puts parser
exit 0
end
end
options = Hash(String,String).new
options["someoptionexample"] = "option"
begin
specs = SpecParser.parse_file recipe_file_name, options
pp! specs
rescue e
STDERR.puts "#{e}".colorize(:red).bright
end