lib/core/shell.rb in cpl-1.1.2.rc.0 vs lib/core/shell.rb in cpl-1.1.2
- old
+ new
@@ -1,10 +1,10 @@
# frozen_string_literal: true
class Shell
class << self
- attr_reader :tmp_stderr
+ attr_reader :tmp_stderr, :verbose
end
def self.shell
@shell ||= Thor::Shell::Color.new
end
@@ -47,7 +47,19 @@
stderr.puts(color("DEPRECATED: #{message}", :yellow))
end
def self.abort(message)
Kernel.abort(color("ERROR: #{message}", :red))
+ end
+
+ def self.verbose_mode(verbose)
+ @verbose = verbose
+ end
+
+ def self.debug(prefix, message)
+ stderr.puts("\n[#{color(prefix, :red)}] #{message}") if verbose
+ end
+
+ def self.should_hide_output?
+ tmp_stderr && !verbose
end
end