mirror of
https://github.com/red-data-tools/YouPlot.git
synced 2025-05-06 07:10:10 +08:00
Add create_main_parser method
This commit is contained in:
parent
3e3b1cdfec
commit
40c5d9fbdf
@ -7,7 +7,7 @@ module Uplot
|
|||||||
|
|
||||||
class Command
|
class Command
|
||||||
attr_accessor :params, :command
|
attr_accessor :params, :command
|
||||||
attr_reader :raw_inputs, :data, :fmt
|
attr_reader :main_parser, :sub_parsers, :raw_inputs, :data, :fmt
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
@params = Params.new
|
@params = Params.new
|
||||||
@ -76,6 +76,7 @@ module Uplot
|
|||||||
.on('--debug', TrueClass) do |v|
|
.on('--debug', TrueClass) do |v|
|
||||||
@debug = v
|
@debug = v
|
||||||
end
|
end
|
||||||
|
yield opt if block_given?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -176,10 +177,8 @@ module Uplot
|
|||||||
parsers
|
parsers
|
||||||
end
|
end
|
||||||
|
|
||||||
def parse_options(argv = ARGV)
|
def create_main_parser
|
||||||
main_parser = create_default_parser
|
create_default_parser do |main_parser|
|
||||||
sub_parsers = create_sub_parsers
|
|
||||||
|
|
||||||
# Usage and help messages
|
# Usage and help messages
|
||||||
main_parser.banner = \
|
main_parser.banner = \
|
||||||
<<~MSG
|
<<~MSG
|
||||||
@ -192,6 +191,12 @@ module Uplot
|
|||||||
|
|
||||||
Options:
|
Options:
|
||||||
MSG
|
MSG
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def parse_options(argv = ARGV)
|
||||||
|
@sub_parsers = create_sub_parsers
|
||||||
|
@main_parser = create_main_parser
|
||||||
|
|
||||||
begin
|
begin
|
||||||
main_parser.order!(argv)
|
main_parser.order!(argv)
|
||||||
|
Loading…
Reference in New Issue
Block a user