class Bismas::CLI::XML

Constants

TYPES

Public Class Methods

defaults() click to toggle source
Calls superclass method
   # File lib/bismas/cli/xml.rb
35 def self.defaults
36   super.merge(type: TYPES.first)
37 end

Public Instance Methods

run(arguments) click to toggle source
   # File lib/bismas/cli/xml.rb
39 def run(arguments)
40   quit unless arguments.empty?
41 
42   if TYPES.include?(type = options[:type])
43     Bismas.to_xml(options, &method(:quit))
44   else
45     unsupported_type(type)
46   end
47 end

Private Instance Methods

opts(opts) click to toggle source
   # File lib/bismas/cli/xml.rb
51 def opts(opts)
52   opts.summary_width = 34
53 
54   opts.option(:input__FILE, 'Path to input file [Default: STDIN]')
55 
56   opts.option(:output__FILE, 'Path to output file [Default: STDOUT]')
57 
58   opts.option(:schema__FILE, 'Path to schema file [Required]')
59 
60   input_options(opts)
61 
62   opts.separator
63   opts.separator 'Output options:'
64 
65   type_option(opts)
66 
67   opts.separator
68 
69   opts.option(:output_encoding__ENCODING, :n, 'Output encoding')
70 
71   opts.separator
72 
73   opts.option(:mapping__FILE_OR_YAML, 'Path to mapping file or YAML string')
74 
75   opts.separator
76 
77   execute_options(opts)
78 end