Class: Agent::Lock::CLI::Commands::Break
- Inherits:
-
TreeCommand
- Object
- Dry::CLI::Command
- Base
- TreeCommand
- Agent::Lock::CLI::Commands::Break
- Defined in:
- lib/agent/lock/cli/commands/break.rb
Overview
Take a lock away from whoever holds it.
Deliberately blunt and deliberately loud: an expired lock is reaped on its own, so reaching for this means overruling a holder that still looks alive. Whoever runs it owns the consequence.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#call(scope:, **options) ⇒ Manager::Result
:broken or :not_found.
Methods inherited from TreeCommand
Methods inherited from Base
Constructor Details
This class inherits a constructor from Agent::Lock::CLI::Commands::Base
Instance Method Details
#call(scope:, **options) ⇒ Manager::Result
Returns :broken or :not_found.
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/agent/lock/cli/commands/break.rb', line 24 def call(scope:, **) result = manager().break_lock(scope) if result.status == :not_found say("NOT LOCKED #{scope}") else warn_("BREAKING #{scope_of(result.record)}, held by #{holder_of(result.record)}") warn_(" intent: #{printable(result.record.intent, lines: true)}") unless result.record.intent.empty? say("Broken. You are responsible for having announced this first.") end finish(result) end |