Module: RfcReader::Terminal

Defined in:
lib/rfc_reader/terminal.rb

Class Method Summary collapse

Class Method Details

.choose(prompt, choices) ⇒ Object

Parameters:

  • prompt (String)
  • choices (Array<String>)

    where all choices are unique



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/rfc_reader/terminal.rb', line 13

def self.choose(prompt, choices)
  require "tty-prompt"
  TTY::Prompt
    .new(
      quiet: true,
      track_history: false,
      interrupt: :exit,
      symbols: { marker: ">" },
      enable_color: !ENV["NO_COLOR"]
    )
    .select(prompt, choices)
end

.page(content) ⇒ Object

Parameters:

  • content (String)


6
7
8
9
# File 'lib/rfc_reader/terminal.rb', line 6

def self.page(content)
  require "tty-pager"
  TTY::Pager.page(content)
end