class Centra::Rule::CLI
Attributes
options[R]
Public Class Methods
new(name:, argv: ARGV)
click to toggle source
# File lib/centra/rule/cli.rb, line 11 def initialize(name:, argv: ARGV) @name = name @options = {} @optparser = nil parse_options(argv, @name, @options) end
Public Instance Methods
help()
click to toggle source
# File lib/centra/rule/cli.rb, line 18 def help @optparser.help end
Private Instance Methods
parse_options(argv, name, options)
click to toggle source
# File lib/centra/rule/cli.rb, line 24 def parse_options(argv, name, options) @optparser = OptionParser.new do |parser| parser.banner = "Usage: #{name} [options]" parser.default_argv = argv parser.on('--rule=rule_export.csv', String, 'Path to Rule export file') do |value| options[:rule_orders_path] = value end parser.on('--centra=centra_export.csv', String, 'Path to Centra orders export file') do |value| options[:centra_orders_path] = value end parser.on('--max-allowed-diff=[90]', Integer, 'Max number of minutes allowed between order timestamps') do |value| options[:allowed_delay_in_minutes] = value end parser.on('--output-missing=[missing.csv]', String, 'Path to missing CSV output path') do |value| options[:missing_output] = value end parser.on('--output-matched=[matched.csv]', String, 'Path to matched CSV output path') do |value| options[:matched_output] = value end CLIUtils.parse_order_filter_args!(parser, options) # No argument, shows at tail. This will print an options summary. parser.on_tail('-h', '--help', 'Show this message') do puts parser exit end end @optparser.parse! end