class Bismas::CLI::XML
Public Instance Methods
run(arguments)
click to toggle source
# File lib/bismas/cli/xml.rb, line 33 def run(arguments) quit unless arguments.empty? Bismas.to_xml(options, &method(:quit)) end
Private Instance Methods
opts(opts)
click to toggle source
# File lib/bismas/cli/xml.rb, line 41 def opts(opts) opts.summary_width = 34 opts.option(:input__FILE, 'Path to input file [Default: STDIN]') opts.option(:output__FILE, 'Path to output file [Default: STDOUT]') opts.option(:schema__FILE, 'Path to schema file [Required]') opts.separator opts.option(:encoding__ENCODING, :N, "Input encoding [Default: #{DEFAULT_ENCODING}]") opts.separator opts.option(:key__KEY, :K, 'ID key of input file') opts.separator opts.option(:mapping__FILE_OR_YAML, 'Path to mapping file or YAML string') opts.separator opts.option(:execute__FILE_OR_CODE, 'Code to execute for each _record_ before mapping') { |e| (options[:execute] ||= []) << e } opts.option(:execute_mapped__FILE_OR_CODE, :E, 'Code to execute for each _record_ after mapping') { |e| (options[:execute_mapped] ||= []) << e } opts.separator opts.switch(:strict, :S, 'Turn parse warnings into errors') opts.switch(:silent, :T, 'Silence parse warnings') end