Class: TempestTime::Commands::Teams::Delete

Inherits:
TempestTime::Command show all
Defined in:
lib/tempest_time/commands/teams/delete.rb

Instance Method Summary collapse

Methods inherited from TempestTime::Command

#command, #date_prompt, #execute, #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

Constructor Details

#initialize(options) ⇒ Delete

Returns a new instance of Delete.



10
11
12
13
# File 'lib/tempest_time/commands/teams/delete.rb', line 10

def initialize(options)
  @teams = TempestTime::Settings::Teams.new
  @options = options
end

Instance Method Details

#execute!Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/tempest_time/commands/teams/delete.rb', line 15

def execute!
  abort('There are no teams to delete!') unless @teams.keys.any?
  team = prompt.select(
    "Which #{pastel.green('team')} would you like to delete?",
    @teams.names
  )
  if prompt.yes?(pastel.red("Are you sure you want to delete #{team}?"))
    @teams.delete(team)
    prompt.say("Successfully #{pastel.red("deleted #{team}!")}")
  else
    abort('Nothing was deleted.')
  end
  execute if prompt.yes?('Delete another team?')
end