Class: Agent::Lock::CLI::Commands::Note
- Inherits:
-
TreeCommand
- Object
- Dry::CLI::Command
- Base
- TreeCommand
- Agent::Lock::CLI::Commands::Note
- Defined in:
- lib/agent/lock/cli/commands/note.rb
Overview
Write down where you are, in the lock itself.
The lock and the notes have one lifespan on purpose. A machine that reboots loses the session but not the file, so the next run reads one document and knows what was underway and how far it got.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#call(scope:, text:, **options) ⇒ Manager::Result
:noted, :not_found or :refused.
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:, text:, **options) ⇒ Manager::Result
Returns :noted, :not_found or :refused.
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/agent/lock/cli/commands/note.rb', line 26 def call(scope:, text:, **) result = manager().note(scope, text) case result.status when :noted then say("NOTED #{scope_of(result.record)}") when :not_found then warn_("NOT LOCKED #{scope}, take the lock before writing in it") when :refused then warn_("REFUSED: #{scope_of(result.record)} is held by #{holder_of(result.record)}") end finish(result) end |