Fix variables

This commit is contained in:
kojix2
2020-09-17 10:28:01 +09:00
parent 975eb95f55
commit b6c3ca9b43
2 changed files with 11 additions and 7 deletions

View File

@@ -1,14 +1,18 @@
module Uplot
class Command
class Parser
attr_reader :command, :params, :main_parser, :sub_parsers
attr_reader :command, :params, :main_parser, :sub_parsers, :delimiter, :transpose, :headers
def initialize
@sub_parsers = create_sub_parsers
@main_parser = create_main_parser
@command = nil
@params = Params.new
end
@delimiter = "\t"
@transpose = false
@headers = nil
end
def create_default_parser
OptionParser.new do |opt|
@@ -51,7 +55,7 @@ module Uplot
params.padding = v
end
opt.on('-c', '--color VAL', 'color of the drawing', String) do |v|
params.color = v =~ /\A[0-9]+\z/ ? v.to_i : v.to_sym
params.color = v =~ /\<[0-9]+\>/ ? v.to_i : v.to_sym
end
opt.on('--[no-]labels', 'hide the labels', TrueClass) do |v|
params.labels = v