Class: Agent::Lock::CLI::Commands::List

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

Overview

Every lock in this repository. Another repository's locks are not this command's, even when they share a Redis.

Instance Attribute Summary

Attributes inherited from Base

#launcher

Instance Method Summary collapse

Methods inherited from TreeCommand

inherited

Methods inherited from Base

#initialize

Constructor Details

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

Instance Method Details

#call(**options) ⇒ Manager::Result

Parameters:

  • options (Hash) —

    :dir, :locking_strategy, :redis_url, :json, :notes

Returns:



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/agent/lock/cli/commands/list.rb', line 23

def call(**options)
  manager = manager(options)
  result = manager.list
  records = result.records.select { |record| this_repo?(record, manager.tree) }

  name_store(manager.store)
  if options[:json]
    report_records(records, json: true, stale_minutes: manager.stale_minutes)
  else
    report_listing(records, manager, notes: options[:notes])
  end

  finish(result)
end