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
-
#browser ⇒ Object
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")). - #client ⇒ Object
- #context ⇒ Object
- #directory ⇒ Object
- #env(name) ⇒ Object
- #file ⇒ Object
- #getpass ⇒ Object
- #gets ⇒ Object
- #print(*args) ⇒ Object
- #puts(*args) ⇒ Object
- #warn(*args) ⇒ Object
Instance Method Details
#browser ⇒ Object
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 |
#client ⇒ Object
32 |
# File 'lib/terminalwire/v2/server/thor.rb', line 32 def client = shell.context |
#context ⇒ Object
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")`). |
#directory ⇒ Object
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) |
#file ⇒ Object
29 |
# File 'lib/terminalwire/v2/server/thor.rb', line 29 def file = shell.context.file |
#getpass ⇒ Object
24 |
# File 'lib/terminalwire/v2/server/thor.rb', line 24 def getpass = shell.context.getpass |
#gets ⇒ Object
23 |
# File 'lib/terminalwire/v2/server/thor.rb', line 23 def gets = shell.context.gets |
#print(*args) ⇒ Object
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) } |