Class: TempestTime::Commands::Teams::Edit
- Inherits:
-
TempestTime::Command
- Object
- TempestTime::Command
- TempestTime::Commands::Teams::Edit
- Defined in:
- lib/tempest_time/commands/teams/edit.rb
Instance Method Summary collapse
- #execute! ⇒ Object
-
#initialize(options) ⇒ Edit
constructor
A new instance of Edit.
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
Methods included from Helpers::FormattingHelper
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) ⇒ Edit
Returns a new instance of Edit.
10 11 12 |
# File 'lib/tempest_time/commands/teams/edit.rb', line 10 def initialize() @options = end |
Instance Method Details
#execute! ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/tempest_time/commands/teams/edit.rb', line 14 def execute! teams = TempestTime::Settings::Teams.new abort('There are no teams to edit!') unless teams.names.any? team = prompt.select( "Which #{pastel.green('team')} would you like to edit?", teams.names ) members = teams.members(team) member = prompt.select( "Which #{pastel.green('member')} would you like to edit?", members + ['Add New Member'] ) replacement = prompt.ask( "Enter the #{pastel.green('new name')}. "\ "Leave blank to #{pastel.red('delete')}." ) teams.remove(team, member) if replacement.nil? prompt.say("Deleted #{pastel.red(member)}!") else teams.append(team, replacement) prompt.say("Added #{pastel.green(replacement)}") end execute unless prompt.no?('Keep editing?') end |