mirror of
https://github.com/red-data-tools/YouPlot.git
synced 2025-05-06 07:10:10 +08:00
Prevent option parser from starting automatically
This commit is contained in:
parent
ff7b0680aa
commit
02857a46a3
@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
require 'uplot'
|
require 'uplot'
|
||||||
|
|
||||||
Uplot::Command.new(ARGV).run
|
Uplot::Command.new.run
|
||||||
|
@ -100,7 +100,7 @@ module Uplot
|
|||||||
attr_accessor :params, :plot_type
|
attr_accessor :params, :plot_type
|
||||||
attr_reader :raw_inputs
|
attr_reader :raw_inputs
|
||||||
|
|
||||||
def initialize(argv)
|
def initialize
|
||||||
@params = Params.new
|
@params = Params.new
|
||||||
|
|
||||||
@plot_type = nil
|
@plot_type = nil
|
||||||
@ -113,8 +113,6 @@ module Uplot
|
|||||||
|
|
||||||
@raw_inputs = []
|
@raw_inputs = []
|
||||||
@debug = false
|
@debug = false
|
||||||
|
|
||||||
parse_options(argv)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_parser
|
def create_parser
|
||||||
@ -172,7 +170,7 @@ module Uplot
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def parse_options(argv)
|
def parse_options(argv = ARGV)
|
||||||
main_parser = create_parser
|
main_parser = create_parser
|
||||||
parsers = Hash.new { |h, k| h[k] = create_parser }
|
parsers = Hash.new { |h, k| h[k] = create_parser }
|
||||||
|
|
||||||
@ -308,6 +306,7 @@ module Uplot
|
|||||||
end
|
end
|
||||||
|
|
||||||
def run
|
def run
|
||||||
|
parse_options
|
||||||
# Sometimes the input file does not end with a newline code.
|
# Sometimes the input file does not end with a newline code.
|
||||||
while input = Kernel.gets(nil)
|
while input = Kernel.gets(nil)
|
||||||
input.freeze
|
input.freeze
|
||||||
|
Loading…
Reference in New Issue
Block a user