Method: Prmd::CLI::Combine.make_parser

Defined in:
lib/prmd/cli/combine.rb

.make_parser(options = {}) ⇒ OptionParser

Returns a OptionParser for parsing ‘combine’ command options.

Parameters:

  • options (Hash<Symbol, Object>) (defaults to: {})

Returns:



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/prmd/cli/combine.rb', line 14

def self.make_parser(options = {})
  binname = options.fetch(:bin, 'prmd')

  OptionParser.new do |opts|
    opts.banner = "#{binname} combine [options] <file or directory>"
    opts.on('-m', '--meta FILENAME', String, 'Set defaults for schemata') do |m|
      yield :meta, m
    end
    opts.on('-o', '--output-file FILENAME', String, 'File to write result to') do |n|
      yield :output_file, n
    end
    opts.on('-t', '--type-as-string', 'Allow type as string') do |t|
      options[:type_as_string] = t
    end
  end
end