read-spec tool
This commit is contained in:
parent
2906e03ff7
commit
feeed2306c
27
read-spec.cr
Normal file
27
read-spec.cr
Normal 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
|
Reference in New Issue
Block a user