Class: Agent::Lock::CLI::Commands::Mine

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

Overview

What this session holds, and what its sub-agents hold, since those are what its release-all would take with it. Never its parent's: a sub-agent that saw those as its own could release them.

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(**options) ⇒ Manager::Result

Parameters:

  • options (Hash)

Returns:



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/agent/lock/cli/commands/mine.rb', line 19

def call(**options)
  manager = manager(options[:dir])
  result = manager.mine

  if result.records.empty?
    say(options[:json] ? "[]" : "No locks held by #{manager.identity.id}.")
  else
    report_records(result.records, json: options[:json], stale_minutes: manager.stale_minutes)
  end

  finish(result)
end