From 41acac88117ebfadcce51a3ad7d594b620c47e15 Mon Sep 17 00:00:00 2001 From: kojix2 <2xijok@gmail.com> Date: Thu, 4 Feb 2021 18:09:47 +0900 Subject: [PATCH] Add color-output and monochrome options --- lib/youplot/command/parser.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/youplot/command/parser.rb b/lib/youplot/command/parser.rb index 2343d09..0a50e9c 100644 --- a/lib/youplot/command/parser.rb +++ b/lib/youplot/command/parser.rb @@ -90,6 +90,12 @@ module YouPlot parser.on('-p', '--progress', TrueClass, 'progressive mode [experimental]') do |v| options[:progressive] = v end + parser.on('-C', '--color-output', TrueClass, 'colorize even if writing to a pipe') do |v| + UnicodePlot::StyledPrinter.define_method(:color?){ |o| true } + end + parser.on('-M', '--monochrome', TrueClass, 'no colouring even if writing to a tty') do |v| + UnicodePlot::StyledPrinter.define_method(:color?){ |o| false } + end parser.on('--encoding STR', String, 'Specify the input encoding') do |v| options[:encoding] = v end