Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion bin/papertrail
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@ require 'papertrail/cli'

begin
Papertrail::Cli.new.run

rescue Interrupt, Errno::EPIPE
exit(0)
exit 0

rescue ArgumentError => e
$stderr.puts "Argument Error: #{e.message}"
exit 1

rescue OptionParser::InvalidOption => e
$stderr.puts e.message
exit 1

end
6 changes: 4 additions & 2 deletions lib/papertrail/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def run
options.merge!(configfile_options)
end

OptionParser.new do |opts|
option_parser = OptionParser.new do |opts|
opts.banner = "papertrail - command-line tail and search for Papertrail log management service"
opts.version = Papertrail::VERSION

Expand Down Expand Up @@ -83,7 +83,9 @@ def run
end

opts.separator usage
end.parse!
end

option_parser.parse!

if options[:configfile]
configfile_options = load_configfile(options[:configfile])
Expand Down