diff --git a/exe/uplot b/exe/uplot index abd6401..5d740e2 100755 --- a/exe/uplot +++ b/exe/uplot @@ -2,4 +2,4 @@ require 'uplot' -Uplot::Command.new(ARGV).run +Uplot::Command.new.run diff --git a/lib/uplot/command.rb b/lib/uplot/command.rb index ae46509..c07e144 100644 --- a/lib/uplot/command.rb +++ b/lib/uplot/command.rb @@ -100,7 +100,7 @@ module Uplot attr_accessor :params, :plot_type attr_reader :raw_inputs - def initialize(argv) + def initialize @params = Params.new @plot_type = nil @@ -113,8 +113,6 @@ module Uplot @raw_inputs = [] @debug = false - - parse_options(argv) end def create_parser @@ -172,7 +170,7 @@ module Uplot end end - def parse_options(argv) + def parse_options(argv = ARGV) main_parser = create_parser parsers = Hash.new { |h, k| h[k] = create_parser } @@ -308,6 +306,7 @@ module Uplot end def run + parse_options # Sometimes the input file does not end with a newline code. while input = Kernel.gets(nil) input.freeze