Module: Fatty::OutputApi

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

Instance Method Summary collapse

Instance Method Details

#append(text, follow: true) ⇒ Object



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

def append(text, follow: true)
  queue(Command.session(output_id, :append, text: text.to_s, follow: follow))
  nil
end

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



10
11
12
13
14
15
16
17
18
# File 'lib/fatty/api/output.rb', line 10

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

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

  nil
end

#markdown(text) ⇒ Object



20
21
22
23
24
25
26
27
28
29
# File 'lib/fatty/api/output.rb', line 20

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