Class: LanguageOperator::CLI::Formatters::ProgressFormatter

Inherits:
Object
  • Object
show all
Extended by:
Helpers::UxHelper
Defined in:
lib/language_operator/cli/formatters/progress_formatter.rb

Overview

Beautiful progress output for CLI operations

Class Method Summary collapse

Methods included from Helpers::UxHelper

box, highlight_ruby_code, logo, pastel, prompt, spinner, table

Class Method Details

.debug(message) ⇒ Object



44
45
46
47
# File 'lib/language_operator/cli/formatters/progress_formatter.rb', line 44

def debug(message)
  icon = LogStyle.styled_icon(:debug, pastel)
  puts "#{icon} #{pastel.dim(message)}"
end

.error(message) ⇒ Object



35
36
37
# File 'lib/language_operator/cli/formatters/progress_formatter.rb', line 35

def error(message)
  puts LogStyle.format(:error, message, pastel)
end

.info(message) ⇒ Object



39
40
41
42
# File 'lib/language_operator/cli/formatters/progress_formatter.rb', line 39

def info(message)
  icon = LogStyle.styled_icon(:info, pastel)
  puts "#{icon} #{pastel.dim(message)}"
end

.success(message) ⇒ Object



30
31
32
33
# File 'lib/language_operator/cli/formatters/progress_formatter.rb', line 30

def success(message)
  icon = LogStyle.styled_icon(:success, pastel)
  puts "#{icon} #{message}"
end

.warn(message) ⇒ Object



49
50
51
# File 'lib/language_operator/cli/formatters/progress_formatter.rb', line 49

def warn(message)
  puts "#{LogStyle.styled_icon(:warn, pastel)} #{pastel.bold(message)}"
end

.with_spinner(message, success_msg: nil, &block) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/language_operator/cli/formatters/progress_formatter.rb', line 14

def with_spinner(message, success_msg: nil, &block)
  spin = spinner("#{message}...")
  spin.auto_spin

  result = block.call

  # Determine what to show after spinner completes
  final_status = success_msg || 'done'

  spin.success(final_status)
  result
rescue StandardError => e
  spin.error(e.message)
  raise
end