Sha256: 9417d4bb45950815930c2c96c141c0db606e36647a37ad43d951060e23dcf746
Contents?: true
Size: 1.31 KB
Versions: 15
Compression:
Stored size: 1.31 KB
Contents
require_relative 'base' require_relative '../commands/combine' module Prmd module CLI # 'combine' command module. module Combine extend CLI::Base # Returns a OptionParser for parsing 'combine' command options. # # @param (see Prmd::CLI::Base#make_parser) # @return (see Prmd::CLI::Base#make_parser) 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 # Executes the 'combine' command. # # @example Usage # Prmd::CLI::Combine.execute(argv: ['schema/schemata/api'], # meta: 'schema/meta.json', # output_file: 'schema/api.json') # # @param (see Prmd::CLI::Base#execute) # @return (see Prmd::CLI::Base#execute) def self.execute(options = {}) write_result Prmd.combine(options[:argv], options).to_s, options end end end end
Version data entries
15 entries across 15 versions & 1 rubygems