Method: PutText::Cmdline#run

Defined in:
lib/puttext/cmdline.rb

#run(args) ⇒ Object

Run the commmand line tool puttext.

Parameters:

  • the command line arguments.



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/puttext/cmdline.rb', line 18

def run(args)
  options = parse_args(args)
  po_file = Extractor.new.extract(options[:path])

  if options[:output_file]
    with_output_file(options[:output_file]) { |f| po_file.write_to(f) }
  else
    po_file.write_to(STDOUT)
  end
rescue => e
  error(e)
end