mirror of
https://github.com/red-data-tools/YouPlot.git
synced 2025-05-05 22:31:11 +08:00
Added --config option
This commit is contained in:
parent
27a84a4df1
commit
b1baa4073c
@ -40,24 +40,6 @@ module YouPlot
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
# config command
|
|
||||||
if @command == :config
|
|
||||||
if ENV['MYYOUPLOTRC']
|
|
||||||
puts "config file : #{ENV['MYYOUPLOTRC']}"
|
|
||||||
puts parser.config.inspect
|
|
||||||
else
|
|
||||||
puts <<~EOS
|
|
||||||
You don't have a config file. The default config file paths are:
|
|
||||||
./.youplot.yml, ./.youplotrc, ~/.youplot.yml, ~/.youplotrc
|
|
||||||
You can specify a config file with the environment variable MYYOUPLOTRC.
|
|
||||||
File format is YAML. For example:
|
|
||||||
width : 40
|
|
||||||
height : 20
|
|
||||||
EOS
|
|
||||||
end
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
# progressive mode
|
# progressive mode
|
||||||
if options[:progressive]
|
if options[:progressive]
|
||||||
stop = false
|
stop = false
|
||||||
|
@ -189,6 +189,7 @@ module YouPlot
|
|||||||
colors color show the list of available colors
|
colors color show the list of available colors
|
||||||
|
|
||||||
General options:
|
General options:
|
||||||
|
--config print config file info
|
||||||
--help print command specific help menu
|
--help print command specific help menu
|
||||||
--version print the version of YouPlot
|
--version print the version of YouPlot
|
||||||
MSG
|
MSG
|
||||||
@ -198,6 +199,10 @@ module YouPlot
|
|||||||
main_parser.on('--help', 'print sub-command help menu') do
|
main_parser.on('--help', 'print sub-command help menu') do
|
||||||
show_main_help
|
show_main_help
|
||||||
end
|
end
|
||||||
|
|
||||||
|
main_parser.on('--config', 'show config file info') do
|
||||||
|
show_config_info
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def show_main_help(out = $stdout)
|
def show_main_help(out = $stdout)
|
||||||
@ -206,6 +211,23 @@ module YouPlot
|
|||||||
exit if YouPlot.run_as_executable?
|
exit if YouPlot.run_as_executable?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def show_config_info
|
||||||
|
if ENV['MYYOUPLOTRC']
|
||||||
|
puts "config file : #{ENV['MYYOUPLOTRC']}"
|
||||||
|
puts config.inspect
|
||||||
|
else
|
||||||
|
puts <<~EOS
|
||||||
|
You don't have a config file. The default config file paths are:
|
||||||
|
./.youplot.yml, ./.youplotrc, ~/.youplot.yml, ~/.youplotrc
|
||||||
|
You can specify a config file with the environment variable MYYOUPLOTRC.
|
||||||
|
File format is YAML. For example:
|
||||||
|
width : 40
|
||||||
|
height : 20
|
||||||
|
EOS
|
||||||
|
end
|
||||||
|
exit if YouPlot.run_as_executable?
|
||||||
|
end
|
||||||
|
|
||||||
def sub_parser_add_symbol
|
def sub_parser_add_symbol
|
||||||
sub_parser.on_head('--symbol STR', String, 'character to be used to plot the bars') do |v|
|
sub_parser.on_head('--symbol STR', String, 'character to be used to plot the bars') do |v|
|
||||||
params.symbol = v
|
params.symbol = v
|
||||||
@ -339,6 +361,7 @@ module YouPlot
|
|||||||
end
|
end
|
||||||
|
|
||||||
when :config
|
when :config
|
||||||
|
show_config_info
|
||||||
|
|
||||||
else
|
else
|
||||||
error_message = "uplot: unrecognized command '#{command}'"
|
error_message = "uplot: unrecognized command '#{command}'"
|
||||||
|
Loading…
Reference in New Issue
Block a user