Class: Abt::Providers::Harvest::Commands::Track
- Inherits:
-
BaseCommand
- Object
- BaseCommand
- BaseCommand
- Abt::Providers::Harvest::Commands::Track
- Defined in:
- lib/abt/providers/harvest/commands/track.rb
Overview
rubocop:disable Metrics/ClassLength
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from BaseCommand
Attributes inherited from BaseCommand
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from BaseCommand
Methods inherited from BaseCommand
Constructor Details
This class inherits a constructor from Abt::Providers::Harvest::BaseCommand
Class Method Details
.description ⇒ Object
12 13 14 15 16 |
# File 'lib/abt/providers/harvest/commands/track.rb', line 12 def self.description <<~TXT Start tracker for current or specified task. Add a relevant ARI to link the time entry, e.g. `abt track harvest asana` TXT end |
.flags ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/abt/providers/harvest/commands/track.rb', line 18 def self.flags [ ["-s", "--set", "Set specified task as current"], ["-c", "--comment COMMENT", "Override comment"], ["-t", "--time HOURS", "Track amount of hours, this will create a stopped entry."], ["-i", "--since HH:MM", "Start entry today at specified time. The computed duration will be deducted from the running entry if one exists."] # rubocop:disable Layout/LineLength ] end |
.usage ⇒ Object
8 9 10 |
# File 'lib/abt/providers/harvest/commands/track.rb', line 8 def self.usage "abt track harvest[:<project-id>/<task-id>] [options]" end |
Instance Method Details
#perform ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/abt/providers/harvest/commands/track.rb', line 29 def perform abort("Flags --time and --since cannot be used together") if flags[:time] && flags[:since] require_task! maybe_adjust_previous_entry entry = create_entry! print_task(entry["project"], entry["task"]) maybe_override_current_task rescue Abt::HttpError::HttpError => _e abort("Invalid task") end |