Improved help banner

Summary width 24
This commit is contained in:
kojix2 2020-10-12 16:14:51 +09:00
parent 7b8213833f
commit 39166894a3

View File

@ -10,22 +10,24 @@ module Uplot
:delimiter, :transpose, :headers, :pass, :output, :fmt, :debug :delimiter, :transpose, :headers, :pass, :output, :fmt, :debug
def initialize def initialize
@command = nil @command = nil
@params = Params.new @params = Params.new
@delimiter = "\t" @delimiter = "\t"
@transpose = false @transpose = false
@headers = nil @headers = nil
@pass = false @pass = false
@output = $stderr @output = $stderr
@fmt = 'xyy' @fmt = 'xyy'
@debug = false @debug = false
end end
def create_default_parser def create_default_parser
OptionParser.new do |opt| OptionParser.new do |opt|
opt.program_name = 'uplot' opt.program_name = 'uplot'
opt.version = Uplot::VERSION opt.version = Uplot::VERSION
opt.summary_width = 24
opt.on_tail('') # Add a blank line at the end
opt.on('-O', '--pass [VAL]', 'file to output standard input data to [stdout]', opt.on('-O', '--pass [VAL]', 'file to output standard input data to [stdout]',
'for inserting uplot in the middle of Unix pipes') do |v| 'for inserting uplot in the middle of Unix pipes') do |v|
@pass = v || $stdout @pass = v || $stdout
@ -90,19 +92,19 @@ module Uplot
Program: uplot (Tools for plotting on the terminal) Program: uplot (Tools for plotting on the terminal)
Version: #{Uplot::VERSION} (using UnicodePlot #{UnicodePlot::VERSION}) Version: #{Uplot::VERSION} (using UnicodePlot #{UnicodePlot::VERSION})
Author: kojix2 <2xijok@gmail.com>
Source: https://github.com/kojix2/uplot Source: https://github.com/kojix2/uplot
Usage: uplot <command> [options] Usage: uplot <command> [options]
Command: barplot bar Commands:
histogram hist barplot bar
lineplot line histogram hist
lineplots lines lineplot line
scatter s lineplots lines
density d scatter s
boxplot box density d
colors boxplot box
colors
Options: Options:
MSG MSG
@ -112,6 +114,7 @@ module Uplot
def sub_parser def sub_parser
@sub_parser ||= create_default_parser do |parser| @sub_parser ||= create_default_parser do |parser|
parser.banner = <<~MSG parser.banner = <<~MSG
Usage: uplot #{command} [options] Usage: uplot #{command} [options]
Options: Options:
@ -126,7 +129,7 @@ module Uplot
parser.on('--symbol VAL', String, 'character to be used to plot the bars') do |v| parser.on('--symbol VAL', String, 'character to be used to plot the bars') do |v|
params.symbol = v params.symbol = v
end end
parser.on('--xscale VAL', String, 'axis scaling') do |v| parser.on('--xscale VAL', String, 'axis scaling') do |v|
params.xscale = v params.xscale = v
end end