Class: Agent::Lock::CLI::Commands::Check

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

Overview

Ask before writing. Exits 1 when anything overlapping is held, so a shell script can gate on it without parsing anything.

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

Returns :free, :mine or :held.

Parameters:

  • scope (String)
  • options (Hash) —

    :dir, :locking_strategy, :redis_url, :json

Returns:



23
24
25
26
27
28
# File 'lib/agent/lock/cli/commands/check.rb', line 23

def call(scope:, **options)
  manager = manager(options)
  result = manager.check(scope)
  report(result, scope, json: options[:json], stale_minutes: manager.stale_minutes)
  finish(result)
end