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
86
87
88
89
|
# File 'lib/code_web/cli.rb', line 58
def parse_arguments
self.report_generator = ::CodeWeb::HtmlReport
self.output = STDOUT
OptionParser.new do |opt|
opt.banner = "Usage: code_web regex [file_name ...]"
opt.on('-t', '--text', 'Use text reports') { |v| self.report_generator = ::CodeWeb::TextReport }
opt.on('-u', '--url URL', 'Base url (e.g.: https://github.com/miq/miq/blob/master)') { |v| self.base_url = v }
opt.on('-b', '--both', 'Show file and url references') { |v| self.file_and_url = v }
opt.on('-a', '--arg ARG_REGEX', 'Only files with hash argument') { |v| self.arg_regex = Regexp.new(v) }
opt.on('-o', '--output FILENAME', 'Output filename') { |v| self.output = (v == '-') ? STDOUT : File.new(v,'w') }
opt.on('-e', '--error-out', 'exit on unknown tags') { |v| self.exit_on_error = true}
opt.on('-V', '--verbose', 'verbose parsing') { |v| self.verbose = true}
opt.on('-D', '--debug', 'debug parsing') { |v| self.debug = true}
opt.on('-p', '--pattern FILENAME_REGEX=COLOR','color to emphasize a file') { |v| v = v.split('=') ; self.class_map[Regexp.new(v.first)] = v.last }
opt.on('--byebug') { require "byebug" }
opt.on('--pry') { require "pry" }
opt.on_tail("-h", "--help", "Show this message") { puts opt ; exit }
opt.on_tail("-v", "--version", "Show version_information") { puts "Code Web version #{CodeWeb::VERSION}" ; exit }
opt.parse!(arguments)
if arguments.length == 0
puts opt
exit
end
end
self.method_regex = Regexp.new(arguments[0])
self.filenames = arguments[1..-1] || "."
end
|