Class: TempestTime::Commands::Report
- Inherits:
-
TempestTime::Command
- Object
- TempestTime::Command
- TempestTime::Commands::Report
- Includes:
- Helpers::TimeHelper
- Defined in:
- lib/tempest_time/commands/report.rb
Instance Method Summary collapse
- #execute(input: $stdin, output: $stdout) ⇒ Object
-
#initialize(users, options) ⇒ Report
constructor
A new instance of Report.
Methods included from Helpers::TimeHelper
#beginning_of_this_week, #beginning_of_week, #formatted_date, #formatted_date_range, #formatted_time, #parsed_date_input, #parsed_time, #this_week
Methods inherited from TempestTime::Command
#command, #pastel, #prompt, #spinner, #table, #with_spinner, #with_success_fail_spinner
Constructor Details
#initialize(users, options) ⇒ Report
13 14 15 16 |
# File 'lib/tempest_time/commands/report.rb', line 13 def initialize(users, ) @users = users || [] = end |
Instance Method Details
#execute(input: $stdin, output: $stdout) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/tempest_time/commands/report.rb', line 18 def execute(input: $stdin, output: $stdout) team = [:team] @users = prompt_for_input if @users.empty? && team.nil? @users.push(TempestTime::Settings::Teams.members(team)) if team abort('No users specified.') unless @users.any? with_spinner('Generating report...') do |spinner| table = render_table spinner.stop(pastel.green('Your report is ready!')) date_range = "#{formatted_date(report.start_date)}"\ ' to '\ "#{formatted_date(report.end_date)}" prompt.say("\nReport for #{pastel.green(date_range)}") puts table end end |