mirror of
				https://github.com/red-data-tools/YouPlot.git
				synced 2025-11-04 11:38:10 +08:00 
			
		
		
		
	Fix style
This commit is contained in:
		@@ -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)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user