Class: Agent::Lock::CLI::Commands::Base Abstract

Inherits:
Dry::CLI::Command
  • Object
show all
Defined in:
lib/agent/lock/cli/commands/base.rb

Overview

This class is abstract.

Subclass and implement #call(**options).

What every command shares: the launcher it prints through, the manager it delegates to, and the wording of a held lock.

Nothing here calls puts or exit. Output goes to the launcher's streams and the exit code is handed back to it, which is what lets the whole CLI run inside the test process.

Commands that read or write a lock store subclass TreeCommand instead, which adds --dir. The rest (version, whoami, skills) never look at a tree, so offering them --dir would be a flag that silently does nothing.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(launcher = nil) ⇒ Base

Returns a new instance of Base.

Parameters:

  • launcher (Launcher) (defaults to: nil)


31
32
33
34
# File 'lib/agent/lock/cli/commands/base.rb', line 31

def initialize(launcher = nil)
  super()
  @launcher = launcher
end

Instance Attribute Details

#launcher ⇒ Launcher (readonly)

Returns the streams, program name and exit code holder.

Returns:

  • (Launcher) —

    the streams, program name and exit code holder



28
29
30
# File 'lib/agent/lock/cli/commands/base.rb', line 28

def launcher
  @launcher
end