Class: BibSync::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/bibsync/command.rb

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Command

Returns a new instance of Command.



6
7
8
9
# File 'lib/bibsync/command.rb', line 6

def initialize(args)
  @args = args
  @options = {}
end

Instance Method Details

#runObject



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/bibsync/command.rb', line 11

def run
  @opts = OptionParser.new(&method(:set_opts))
  @opts.parse!(@args)
  process
  exit 0
rescue Exception => ex
  raise ex if Log.trace || SystemExit === ex
  $stderr.print "#{ex.class}: " if ex.class != RuntimeError
  $stderr.puts ex.message
  $stderr.puts '  Use --trace for backtrace.'
  exit 1
end