Class: Everywhere::Dock::Null

Inherits:
Object
  • Object
show all
Defined in:
lib/everywhere/dock.rb

Overview

The headless stand-in: same API, no escape sequences ever. Used for CI, pipes, | tee, dumb terminals and windows too small to spare the rows. It narrates transitions as ordinary lines so a piped log still reads.

Note it never installs itself as Console's sink — output keeps going straight to $stdout, exactly as it did before the dock existed.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(targets, keys: true) ⇒ Null

Returns a new instance of Null.



209
210
211
212
# File 'lib/everywhere/dock.rb', line 209

def initialize(targets, keys: true)
  @state = State.new(targets)
  @keys = keys
end

Instance Attribute Details

#stateObject (readonly)

Returns the value of attribute state.



214
215
216
# File 'lib/everywhere/dock.rb', line 214

def state
  @state
end

Instance Method Details

#announce_keysObject

The one-shot keymap the old command printed, kept for headless runs.



231
232
233
234
235
# File 'lib/everywhere/dock.rb', line 231

def announce_keys
  return unless @keys

  UI.note(KEYS.map { |key, desc| "#{UI.bold(key)} #{desc}" }.join(" · "), marker: "", color: :cyan)
end

#clearObject



227
# File 'lib/everywhere/dock.rb', line 227

def clear = nil

#closeObject



228
# File 'lib/everywhere/dock.rb', line 228

def close = nil

#detail(_key, _text) ⇒ Object



223
# File 'lib/everywhere/dock.rb', line 223

def detail(_key, _text) = nil

#emit(text) ⇒ Object



225
# File 'lib/everywhere/dock.rb', line 225

def emit(text) = nil

#installObject



216
# File 'lib/everywhere/dock.rb', line 216

def install = self

#refreshObject



226
# File 'lib/everywhere/dock.rb', line 226

def refresh = nil

#set(key, state, detail: nil) ⇒ Object



218
219
220
221
# File 'lib/everywhere/dock.rb', line 218

def set(key, state, detail: nil)
  target = @state.set(key, state, detail: detail) or return
  UI.step("#{target.label}#{[state, detail].compact.join(" ")}")
end

#toggle_helpObject



224
# File 'lib/everywhere/dock.rb', line 224

def toggle_help = nil