Module: Terminalwire::V2::Rails::Thor
- Defined in:
- lib/terminalwire/v2/rails.rb
Overview
Drop-in Rails terminal mixin — the v2 equivalent of v1's Terminalwire::Thor.
include Terminalwire::V2::Rails::Thor in your Thor CLI and it:
* streams I/O over the v2 wire (Terminalwire::V2::Server::Thor),
* exposes the client `session` (the shell delegator), and
* mixes in Rails route URL helpers (root_url, *_url, *_path) so commands like
login/browser-open can build links. The per-connection host is set by the
handler, so the *_url helpers resolve to the host the client connected on.
The url_helpers go in no_commands so Thor doesn't register them as commands.
Class Method Summary collapse
Class Method Details
.included(base) ⇒ Object
197 198 199 200 201 202 203 204 |
# File 'lib/terminalwire/v2/rails.rb', line 197 def self.included(base) base.include Terminalwire::V2::Server::Thor base.class_eval do no_commands do include ::Rails.application.routes.url_helpers end end end |