Module: Fatty::OutputApi

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

Instance Method Summary collapse

Instance Method Details

#append(text, follow: true, role: nil) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/fatty/api/output.rb', line 5

def append(text, follow: true, role: nil)
  payload = {
    text: output_text(text, role: role),
    follow: follow,
  }
  queue(Command.session(output_id, :append, **payload))
  nil
end

#append_now(text, follow: true, mode: nil, role: nil) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/fatty/api/output.rb', line 14

def append_now(text, follow: true, mode: nil, role: nil)
  payload = {
    text: output_text(text, role: role),
    follow: follow,
  }
  payload[:mode] = mode if mode

  terminal.apply_command(Command.session(output_id, :append, **payload))
  terminal.render_frame

  nil
end

#markdown(text) ⇒ Object



27
28
29
30
31
32
33
34
35
36
# File 'lib/fatty/api/output.rb', line 27

def markdown(text)
  md = Fatty::Markdown.render(
    text,
    palette: markdown_palette,
    theme: markdown_theme,
    truecolor: markdown_truecolor?,
  )
  append(md)
  nil
end