lib/goodcheck/cli.rb in goodcheck-2.4.3 vs lib/goodcheck/cli.rb in goodcheck-2.4.4
- old
+ new
@@ -16,21 +16,25 @@
init: "Generate a sample configuration file",
check: "Run check with a configuration",
test: "Test your configuration",
pattern: "Print regexp for rules",
version: "Print version",
- help: "Show goodcheck version and quit"
+ help: "Show help and quit"
}
def run(args)
command = args.shift&.to_sym
if COMMANDS.key?(command)
__send__(command, args)
+ elsif command == :"--version"
+ version(args)
else
+ stderr.puts "Invalid command: #{command}" if command
help(args)
+ 1
end
rescue => exn
stderr.puts exn.inspect
exn.backtrace.each do |bt|
stderr.puts " #{bt}"
@@ -78,10 +82,10 @@
Goodcheck.logger.level = loglevel
if args.empty?
targets << Pathname(".")
else
- targets.push *args.map {|arg| Pathname(arg) }
+ args.each {|arg| targets << Pathname(arg) }
end
reporter = case format
when "text", nil
Reporters::Text.new(stdout: stdout)