Module: Terminalwire::V2::Server::Thor::Helpers

Defined in:
lib/terminalwire/v2/server/thor.rb

Overview

Bare puts/print/gets inside Thor commands. Defined in a module so Thor's method_added hook never sees them and they are not registered as commands.

Instance Method Summary collapse

Instance Method Details

#browserObject

The client-side resources, exposed on the CLI instance like v1 (so a Thor command can call browser.launch(url), file.read(path), env("HOME")).



28
# File 'lib/terminalwire/v2/server/thor.rb', line 28

def browser = shell.context.browser

#clientObject



32
# File 'lib/terminalwire/v2/server/thor.rb', line 32

def client = shell.context

#contextObject



25
26
27
# File 'lib/terminalwire/v2/server/thor.rb', line 25

def context = shell.context
# The client-side resources, exposed on the CLI instance like v1 (so a Thor
# command can call `browser.launch(url)`, `file.read(path)`, `env("HOME")`).

#directoryObject



30
# File 'lib/terminalwire/v2/server/thor.rb', line 30

def directory = shell.context.directory

#env(name) ⇒ Object



31
# File 'lib/terminalwire/v2/server/thor.rb', line 31

def env(name) = shell.context.env(name)

#fileObject



29
# File 'lib/terminalwire/v2/server/thor.rb', line 29

def file = shell.context.file

#getpassObject



24
# File 'lib/terminalwire/v2/server/thor.rb', line 24

def getpass = shell.context.getpass

#getsObject



23
# File 'lib/terminalwire/v2/server/thor.rb', line 23

def gets = shell.context.gets


21
# File 'lib/terminalwire/v2/server/thor.rb', line 21

def print(*args) = args.each { |arg| shell.context.print(arg.to_s) }

#puts(*args) ⇒ Object



20
# File 'lib/terminalwire/v2/server/thor.rb', line 20

def puts(*args) = shell.context.puts(*args.flatten.map(&:to_s))

#warn(*args) ⇒ Object



22
# File 'lib/terminalwire/v2/server/thor.rb', line 22

def warn(*args) = args.each { |arg| shell.context.warn(arg.to_s) }