Module: Prmd::CLI::Render
- Extended by:
- Base
- Defined in:
- lib/prmd/cli/render.rb
Overview
‘render’ command module.
Class Method Summary collapse
-
.execute(options = {}) ⇒ void
Executes the ‘render’ command.
-
.make_parser(options = {}) ⇒ OptionParser
Returns a OptionParser for parsing ‘render’ command options.
Methods included from Base
execute, make_parser, noop_execute, parse_options, run
Class Method Details
.execute(options = {}) ⇒ void
This method returns an undefined value.
Executes the ‘render’ command.
40 41 42 43 44 45 |
# File 'lib/prmd/cli/render.rb', line 40 def self.execute( = {}) filename = .fetch(:argv).first _, data = try_read(filename) schema = Prmd::Schema.new(data) write_result Prmd.render(schema, ), end |
.make_parser(options = {}) ⇒ OptionParser
Returns a OptionParser for parsing ‘render’ command options.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/prmd/cli/render.rb', line 14 def self.make_parser( = {}) binname = .fetch(:bin, 'prmd') OptionParser.new do |opts| opts. = "#{binname} render [options] <combined schema>" opts.on('-p', '--prepend header,overview', Array, 'Prepend files to output') do |p| yield :prepend, p end opts.on('-t', '--template templates', String, 'Use alternate template') do |t| yield :template, t end opts.on('-o', '--output-file FILENAME', String, 'File to write result to') do |n| yield :output_file, n end end end |