Class: TempestTime::Commands::Track
- Inherits:
-
TempestTime::Command
- Object
- TempestTime::Command
- TempestTime::Commands::Track
- Defined in:
- lib/tempest_time/commands/track.rb
Instance Method Summary collapse
- #execute(input: $stdin, output: $stdout) ⇒ Object
-
#initialize(time, issues, options) ⇒ Track
constructor
A new instance of Track.
Methods inherited from TempestTime::Command
#command, #date_prompt, #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, #end_of_week, #formatted_date, #formatted_date_range, #formatted_time, #formatted_time_for_input, #formatted_time_long, #parsed_time, #past_date_selections, #past_week_selections, #week_beginnings, #week_dates
Constructor Details
#initialize(time, issues, options) ⇒ Track
Returns a new instance of Track.
11 12 13 14 15 |
# File 'lib/tempest_time/commands/track.rb', line 11 def initialize(time, issues, ) @time = time @issues = issues = end |
Instance Method Details
#execute(input: $stdin, output: $stdout) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/tempest_time/commands/track.rb', line 17 def execute(input: $stdin, output: $stdout) time = [:split] ? parsed_time(@time) / @issues.count : parsed_time(@time) issues = @issues.any? ? @issues.map(&:upcase) : [automatic_issue] unless [:autoconfirm] = "Track #{formatted_time(time)}, "\ "#{billability(@options)}, "\ "to #{issues.join(', ')}?" abort unless prompt.yes?(, convert: :bool) end issues.each do |issue| track_time(time, .merge('issue' => issue)) end end |