lib/output_mode/tldr/show.rb in output_mode-1.3.0 vs lib/output_mode/tldr/show.rb in output_mode-1.4.0

- old
+ new

@@ -63,19 +63,23 @@ # # The +template+ overrides the default erb template for the output # # An interative/ non-interactive output can be forced by setting the # +interactive+ flag to +true+/+false+ respectively - def build_output(verbose: false, ascii: false, interactive: nil, template: nil) - callables = if verbose || !$stdout.tty? + def build_output(verbose: nil, ascii: false, interactive: nil, template: nil) + # Set the interactive and verbose flags if not provided + interactive = $stdout.tty? if interactive.nil? + verbose = !interactive if verbose.nil? + + callables = if verbose # Filter out columns that are explicitly not verbose output_callables.select { |o| o.verbose?(true) } else # Filter out columns that are explicitly verbose output_callables.reject(&:verbose?) end - if interactive || (interactive.nil? && $stdout.tty?) + if interactive # Creates the human readable output opts = if ascii { yes: 'yes', no: 'no', colorize: false } else { yes: '✓', no: '✕', colorize: TTY::Color.color? }