Prevent option parser from starting automatically

This commit is contained in:
kojix2 2020-08-15 23:06:55 +09:00
parent ff7b0680aa
commit 02857a46a3
2 changed files with 4 additions and 5 deletions

View File

@ -2,4 +2,4 @@
require 'uplot'
Uplot::Command.new(ARGV).run
Uplot::Command.new.run

View File

@ -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