Class: RbsInlineData::CLI
- Inherits:
-
Object
- Object
- RbsInlineData::CLI
- Defined in:
- lib/rbs_inline_data/cli.rb
Overview
Process executed when running the rbs-inline-data command.
Instance Method Summary collapse
-
#run(args) ⇒ Object
-
(Array) -> void.
Instance Method Details
#run(args) ⇒ Object
-
(Array) -> void
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/rbs_inline_data/cli.rb', line 12 def run(args) # @type var output_path: Pathname? output_path = nil OptionParser.new do |opts| opts.on("--output", "Output to stdout instead of writing to files") do output_path = Pathname("sig/generated/data") end end.parse!(args) get_targets(args[0]).each do |target| result = Prism.parse_file(target.to_s) definitions = Parser.parse(result) Writer.write(definitions, output_path ? (output_path + target).sub_ext(".rbs") : nil) end end |