Class: Taski::Progress::Theme::Compact

Inherits:
Default show all
Defined in:
lib/taski/progress/theme/compact.rb

Overview

Compact theme for TTY environments with single-line progress display. Provides spinner animation, colored icons, and status formatting.

Output format:

⠹ [3/5] DeployTask | Uploading files...
✓ [5/5] All tasks completed (1.2s)

Examples:

Usage

layout = Taski::Progress::Layout::Simple.new(
  theme: Taski::Progress::Theme::Compact.new
)

Custom spinner frames

class MoonTheme < Taski::Progress::Theme::Compact
  def spinner_frames
    %w[🌑 🌒 🌓 🌔 🌕 🌖 🌗 🌘]
  end
end

Custom status theme

class JapaneseTheme < Taski::Progress::Theme::Compact
  def format_count(count)
    "#{count}"
  end

  def status_complete
    '{% icon %} {{ execution.done_count | format_count }}完了 ({{ execution.total_duration | format_duration }})'
  end
end

Instance Method Summary collapse

Methods inherited from Base

#clean_fail, #clean_start, #clean_success, #color_dim, #color_green, #color_red, #color_reset, #color_yellow, #execution_start, #format_count, #format_duration, #group_fail, #group_start, #group_success, #icon_failure, #icon_pending, #icon_skip, #icon_success, #render_interval, #spinner_frames, #spinner_interval, #task_fail, #task_pending, #task_skip, #task_start, #task_success, #truncate_list_separator, #truncate_list_suffix, #truncate_text_suffix

Instance Method Details

#execution_completeObject

Execution complete with icon



47
48
49
# File 'lib/taski/progress/theme/compact.rb', line 47

def execution_complete
  "{% icon %} [TASKI] Completed: {{ execution.done_count }}/{{ execution.total_count }} tasks ({{ execution.total_duration | format_duration }})"
end

#execution_failObject

Execution fail with icon



52
53
54
# File 'lib/taski/progress/theme/compact.rb', line 52

def execution_fail
  "{% icon %} [TASKI] Failed: {{ execution.failed_count }}/{{ execution.total_count }} tasks ({{ execution.total_duration | format_duration }})"
end

#execution_runningObject

Execution running with spinner



42
43
44
# File 'lib/taski/progress/theme/compact.rb', line 42

def execution_running
  "{% spinner %} [{{ execution.done_count }}/{{ execution.total_count }}]{% if execution.task_names %} {% for name in execution.task_names limit: 3 %}{{ name | short_name }}{% unless forloop.last %}, {% endunless %}{% endfor %}{% if execution.task_names.size > 3 %}...{% endif %}{% endif %}{% if task.stdout %} | {{ task.stdout | truncate_text: 40 }}{% endif %}"
end