Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Refactorings

  • Loading branch information...
commit 7f9605279636a86dbfb270ccd94af2dc8bc047b4 1 parent a7b691f
Gregory Brown sandal authored

Showing 2 changed files with 9 additions and 10 deletions. Show diff stats Hide diff stats

  1. +2 5 bin/rcat
  2. +7 5 lib/rcat/application.rb
7 bin/rcat
@@ -5,10 +5,7 @@ require_relative "../lib/rcat"
5 5 begin
6 6 RCat::Application.new(ARGV).run
7 7 rescue Errno::ENOENT => err
8   - STDERR.puts "rcat: #{err.message}"
9   - exit(1)
  8 + abort "rcat: #{err.message}"
10 9 rescue OptionParser::InvalidOption => err
11   - STDERR.puts "rcat: #{err.message}"
12   - STDERR.puts "usage: rcat [-bns] [file ...]"
13   - exit(1)
  10 + abort "rcat: #{err.message}\nusage: rcat [-bns] [file ...]"
14 11 end
12 lib/rcat/application.rb
@@ -18,11 +18,13 @@ def run
18 18
19 19 def parse_options(argv)
20 20 params = {}
21   - files = OptionParser.new do |parser|
22   - parser.on("-n") { params[:line_numbering_style] ||= :all_lines }
23   - parser.on("-b") { params[:line_numbering_style] = :significant_lines }
24   - parser.on("-s") { params[:squeeze_extra_newlines] = true }
25   - end.parse(argv)
  21 + parser = OptionParser.new
  22 +
  23 + parser.on("-n") { params[:line_numbering_style] ||= :all_lines }
  24 + parser.on("-b") { params[:line_numbering_style] = :significant_lines }
  25 + parser.on("-s") { params[:squeeze_extra_newlines] = true }
  26 +
  27 + files = parser.parse(argv)
26 28
27 29 [params, files]
28 30 end

0 comments on commit 7f96052

Please sign in to comment.
Something went wrong with that request. Please try again.