Module: Fatty::ProgressApi

Included in:
CallbackEnvironment
Defined in:
lib/fatty/api/progress.rb

Instance Method Summary collapse

Instance Method Details

#add_progress(label: Progress::DEFAULT_LABEL, total: nil, style: Progress::DEFAULT_STYLE, role: Progress::DEFAULT_ROLE, width: Progress::DEFAULT_WIDTH) ⇒ Object

Create a transient status-line progress indicator. For style :spinner, total may be omitted for indeterminate progress.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/fatty/api/progress.rb', line 7

def add_progress(
      label: Progress::DEFAULT_LABEL,
      total: nil,
      style: Progress::DEFAULT_STYLE,
      role: Progress::DEFAULT_ROLE,
      width: Progress::DEFAULT_WIDTH
    )
  @progress = Progress.new(
    terminal: terminal,
    label: label,
    total: total,
    style: style,
    role: role,
    width: width,
  )
end