Class: OKF::CLI::Tui

Inherits:
Command
  • Object
show all
Defined in:
lib/okf/plugin.rb

Overview

okf tui — this gem's entry point, and its only one.

The gem has to be separate: six TTY gems plus kramdown and rouge is a dependency set the kernel's deliberate three has no business growing into. None of that argues for a separate entry point, which is what this seam exists to avoid. There briefly was one — an exe/okf-tui that did nothing but call the same CLI.run — and it went before the first release, while removing a name still cost nobody anything. What the seam buys instead is discoverability: somebody who installed okf-tui finds it in okf help without having to know a second command exists.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.help_rowsObject



42
43
44
# File 'lib/okf/plugin.rb', line 42

def self.help_rows
  [ [ "tui       [DIR|@slug…]", "browse bundles in a full-screen terminal UI" ] ]
end

.idObject



38
39
40
# File 'lib/okf/plugin.rb', line 38

def self.id
  :tui
end

Instance Method Details

#call(argv) ⇒ Object

The heavy require lives here so that listing the verb stays cheap.

input is why Command carries a terminal at all: every other verb is a one-shot read that never looks at stdin, and this one cannot work without it. Taking it from the command rather than reaching for $stdin keeps the whole surface inside okf's stream injection — which is what lets "it refuses to run without a terminal" be a test rather than a hope.



54
55
56
57
58
# File 'lib/okf/plugin.rb', line 54

def call(argv)
  require "okf/tui/cli"

  ::OKF::TUI::CLI.run(argv, out: @out, err: @err, input: input)
end