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

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

Overview

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.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(launcher = nil) ⇒ Base

Returns a new instance of Base.

Parameters:

  • launcher (Launcher) (defaults to: nil)


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

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

Instance Attribute Details

#launcher ⇒ Object (readonly)

Returns the value of attribute launcher.



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

def launcher
  @launcher
end

Class Method Details

.inherited(subclass) ⇒ Object

Inherited by every command, so --dir works everywhere without each one restating it.



21
22
23
24
25
# File 'lib/agent/lock/cli/commands/base.rb', line 21

def self.inherited(subclass)
  super
  subclass.option :dir, type: :string, default: ".",
                        desc: "Work as if run from this directory"
end