mirror of
https://github.com/red-data-tools/YouPlot.git
synced 2025-05-06 15:11:12 +08:00
Fix style
This commit is contained in:
parent
7e42caa506
commit
0d7bac71d8
@ -1,18 +1,19 @@
|
|||||||
require 'optparse'
|
require 'optparse'
|
||||||
require 'csv'
|
require 'csv'
|
||||||
|
require 'unicode_plot'
|
||||||
|
|
||||||
module Uplot
|
module Uplot
|
||||||
class Command
|
class Command
|
||||||
def initialize(argv)
|
def initialize(argv)
|
||||||
@params = {}
|
@params = {}
|
||||||
@ptype = nil
|
@ptype = nil
|
||||||
@headers = nil
|
@headers = nil
|
||||||
@delimiter = "\t"
|
@delimiter = "\t"
|
||||||
@transpose = false
|
@transpose = false
|
||||||
@output = false
|
@output = false
|
||||||
@count = false
|
@count = false
|
||||||
@fmt = 'xyy'
|
@fmt = 'xyy'
|
||||||
@debug = false
|
@debug = false
|
||||||
parse_options(argv)
|
parse_options(argv)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -36,20 +37,20 @@ module Uplot
|
|||||||
end
|
end
|
||||||
|
|
||||||
def parse_options(argv)
|
def parse_options(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 }
|
||||||
parsers['bar'] .on('--count', TrueClass) { |v| @count = v }
|
parsers['barplot'] = parsers['bar']
|
||||||
parsers['barplot'] = parsers['bar']
|
.on('--count', TrueClass) { |v| @count = v }
|
||||||
parsers['count'] = parsers['c'] # barplot -c
|
parsers['count'] = parsers['c'] # barplot -c
|
||||||
parsers['hist'] .on('--nbins VAL', Numeric) { |v| @params[:nbins] = v }
|
|
||||||
parsers['histogram'] = parsers['hist']
|
parsers['histogram'] = parsers['hist']
|
||||||
parsers['line'] .on('-x', '--xlim VAL', String) { |v| @params[:xlim] = get_lim(v) }
|
.on('-n', '--nbins VAL', Numeric) { |v| @params[:nbins] = v }
|
||||||
parsers['lineplot'] = parsers['line']
|
parsers['lineplot'] = parsers['line']
|
||||||
parsers['lineplots'] = parsers['lines']
|
.on('-x', '--xlim VAL', String) { |v| @params[:xlim] = get_lim(v) }
|
||||||
parsers['scatterplot'] = parsers['scatter']
|
parsers['lineplots'] = parsers['lines']
|
||||||
parsers['densityplot'] = parsers['density']
|
parsers['scatter']
|
||||||
parsers['boxplot'] = parsers['box']
|
parsers['density']
|
||||||
parsers.default = nil
|
parsers['boxplot'] = parsers['box']
|
||||||
|
parsers.default = nil
|
||||||
|
|
||||||
main_parser.banner = <<~MSG
|
main_parser.banner = <<~MSG
|
||||||
Program: Uplot (Tools for plotting on the terminal)
|
Program: Uplot (Tools for plotting on the terminal)
|
||||||
|
Loading…
Reference in New Issue
Block a user