Class: Agent::Lock::CLI::Commands::Acquire

Inherits:
Base
  • Object
show all
Defined in:
lib/agent/lock/cli/commands/acquire.rb

Overview

Claim a scope, or find out who has it.

Instance Attribute Summary

Attributes inherited from Base

#launcher

Instance Method Summary collapse

Methods inherited from Base

inherited, #initialize

Constructor Details

This class inherits a constructor from Agent::Lock::CLI::Commands::Base

Instance Method Details

#call(scope:, intent: nil, **options) ⇒ Manager::Result

Parameters:

  • scope (String)
  • intent (String, nil) (defaults to: nil)
  • options (Hash)

Returns:



31
32
33
34
35
36
37
38
39
40
# File 'lib/agent/lock/cli/commands/acquire.rb', line 31

def call(scope:, intent: nil, **options)
  manager = manager(options[:dir])
  result = manager.acquire(
    scope, intent: intent || "unspecified",
           enforce: options[:enforce], force: options[:force]
  )

  report(result, manager.stale_minutes)
  finish(result)
end