Module: Terminalwire::V2::Server::DualThor

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

Overview

ONE Thor CLI, BOTH protocols. Apply Server.dualize(MyCLI) to a Thor class that already includes the v1 Terminalwire::Thor adapter, and it runs unchanged over the v1 AND v2 wire. This works because both servers invoke a CLI through the SAME entry — cli_class.terminalwire(arguments:, context:) — and both contexts expose the same I/O surface (puts/print/warn/gets/getpass).

The adapter:

- its single `terminalwire` entry builds the v2 Shell for a v2 context and
otherwise delegates to the v1 adapter via `super` (preserving the v1/rails
shell exactly);
- its helpers route bare puts/print/warn/gets/getpass through the active
`shell.context`, which is whichever protocol's context is live.

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



20
21
22
23
# File 'lib/terminalwire/v2/server/dual_thor.rb', line 20

def self.included(base)
  base.extend ClassMethods
  base.include Terminalwire::V2::Server::Thor::Helpers
end