Module: Prmd::CLI::Combine

Extended by:
Base
Defined in:
lib/prmd/cli/combine.rb

Overview

‘combine’ command module.

Class Method Summary collapse

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 ‘combine’ command.

Examples:

Usage

Prmd::CLI::Combine.execute(argv: ['schema/schemata/api'],
                           meta: 'schema/meta.json',
                           output_file: 'schema/api.json')

Parameters:

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


37
38
39
# File 'lib/prmd/cli/combine.rb', line 37

def self.execute(options = {})
  write_result Prmd.combine(options[:argv], options).to_s, options
end

.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
# 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
  end
end