36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
# File 'lib/rock_books/cmd_line/main.rb', line 36
def parse_command_line
prepend_environment_options
options = options_with_defaults
OptionParser.new do |parser|
parser.on("-h", "--help", "Show help") do |_help_requested|
ARGV << 'h' options.suppress_command_line_validation = true
end
parser.on('-i', '--input_dir DIR',
"Input directory containing source data files, default: '#{DEFAULT_INPUT_DIR}'") do |v|
options.input_dir = File.expand_path(v)
end
parser.on('-o', '--output_dir DIR',
"Output directory to which report files will be written, default: '#{DEFAULT_OUTPUT_DIR}'") do |v|
options.output_dir = File.expand_path(v)
end
parser.on('-r', '--receipt_dir DIR',
"Directory root from which to find receipt filespecs, default: '#{DEFAULT_RECEIPT_DIR}'") do |v|
options.receipt_dir = File.expand_path(v)
end
parser.on('-s', '--shell', 'Start interactive shell') do |v|
options.interactive_mode = true
end
parser.on('-v', '--[no-]verbose', 'Verbose mode') do |v|
options.verbose_mode = v
end
parser.on('-y', '--[no-]say', 'Say error messages.') do |v|
options.say = v
end
parser.on('', '--[no-]receipts', 'Include report on existing and missing receipts.') do |v|
options.do_receipts = v
end
end.parse!
if options.verbose_mode
puts "Run Options:"
ap options.to_h
end
options
end
|