def main(): arguments = docopt(__doc__, version=__version__) calc = PomodoroCalculator( end=arguments['<end-time>'], start=arguments['--from'], pomodoro_length=int(arguments['--pomodoro']), group_length=int(arguments['--group']), short_break=int(arguments['--break']), long_break=int(arguments['--long-break']), time_interval=(arguments['-i']), ) colours = { 'pomodoro': Style.BRIGHT + Fore.RED, 'short-break': Fore.BLUE, 'long-break': Fore.CYAN, } init(autoreset=True) pomodori_count = 0 for segment in calc.pomodori_schedule(): line_dict = {} if segment['type'] == 'pomodoro': pomodori_count += 1 line_dict['id'] = pomodori_count line_dict['name'] = 'Pomodoro' elif segment['type'] == 'short-break': line_dict['id'] = '' line_dict['name'] = 'short break' else: line_dict['id'] = '' line_dict['name'] = 'long break' line_dict['start'] = segment['start'].strftime('%H:%M') line_dict['end'] = segment['end'].strftime('%H:%M') line = "{id:>2} {name:<12} {start} ⇾ {end}".format(**line_dict) print(colours[segment['type']] + line) total = '{:>26} {:>2}'.format('Total Pomodori:', pomodori_count) print(Style.BRIGHT + Fore.WHITE + total) hours = round(pomodori_count * int(arguments['--pomodoro']) / 60, 1) total = '{:>26} {:>2}h'.format('Total Work:', hours) print(Style.BRIGHT + Fore.WHITE + total)
def test_interval_option(self): pomodori = PomodoroCalculator(end='00:55',time_interval=True) segments = pomodori.pomodori_schedule() self.assertEqual(len(segments), 3)