2024-06-13 09:40:09 +02:00
|
|
|
#!/usr/bin/python3
|
|
|
|
|
|
|
|
|
|
import argparse
|
2024-06-13 10:21:19 +02:00
|
|
|
from lib.DataStore import DataStore
|
|
|
|
|
from lib.TimeSlot import TimeSlot
|
2024-06-13 10:38:43 +02:00
|
|
|
from lib.ui import convert_to_table
|
2024-06-13 09:40:09 +02:00
|
|
|
|
|
|
|
|
|
2024-06-13 10:21:19 +02:00
|
|
|
if __name__ == "__main__":
|
|
|
|
|
parser = argparse.ArgumentParser(description='Time tracker')
|
|
|
|
|
parser.add_argument('command', type=str, help='Manage time slots.', choices=['start', 'stop', 'add', 'ps', 'ls'])
|
|
|
|
|
parser.add_argument('-b', '--begin', type=str, help="The start time of a time slot.")
|
|
|
|
|
parser.add_argument('-e', '--end', type=str, help="The end time of a time slot.")
|
2024-06-13 09:40:09 +02:00
|
|
|
|
2024-06-13 10:21:19 +02:00
|
|
|
args = parser.parse_args()
|
2024-06-13 09:40:09 +02:00
|
|
|
|
2024-06-13 10:21:19 +02:00
|
|
|
ds = DataStore("data.json")
|
|
|
|
|
|
|
|
|
|
if args.command == "ls":
|
2024-06-13 10:38:43 +02:00
|
|
|
print(convert_to_table(ds.get_all_time_slots()))
|