Class: TempestTime::Commands::Timer::List

Inherits:
TempestTime::Command show all
Defined in:
lib/tempest_time/commands/timer/list.rb

Instance Method Summary collapse

Methods inherited from TempestTime::Command

#command, #current_user, #date_prompt, #execute, #find_user, #pastel, #prompt, #spinner, #table, #week_prompt, #with_spinner, #with_success_fail_spinner

Methods included from Helpers::GitHelper

#automatic_issue

Methods included from Helpers::FormattingHelper

#braced, #with_percent_sign

Methods included from Helpers::TimeHelper

#beginning_of_week, #dates_in_range, #end_of_week, #formatted_date, #formatted_date_range, #formatted_time, #formatted_time_for_input, #formatted_time_long, #future_dates, #parsed_time, #past_dates, #past_week_selections, #week_beginnings, #week_dates

Instance Method Details

#execute!Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/tempest_time/commands/timer/list.rb', line 11

def execute!
  abort(pastel.red('No timers running!')) unless all_timers.any?
  all_timers.each do |timer|
    TempestTime::Commands::Timer::Status.new(timer.issue).execute
  end
  issue = prompt.select(
    'Please select a timer to toggle / track, or enter ^C to exit.',
    all_timers.map(&:issue)
  )
  action = action_prompt(timer(issue))
  take_action(issue, action)
end