rat-times/main.gd

35 lines
689 B
GDScript3
Raw Normal View History

2023-03-09 20:26:57 +00:00
#!/usr/bin/env -S godot --no-window -s
2023-03-03 21:44:32 +00:00
extends SceneTree
2023-03-04 14:07:03 +00:00
var config: ConfigManager = preload("res://config_manager.tres")
2023-03-03 21:44:32 +00:00
func _init():
2023-03-04 14:07:03 +00:00
var cmd := CMD.new()
2023-03-03 21:44:32 +00:00
for command in ["list", "stop", "start", "current"]:
if cmd.has_argument(command):
call(command)
2023-03-04 14:07:03 +00:00
return
print("no command provided -- exiting")
quit()
2023-03-03 21:44:32 +00:00
func list() -> void:
2023-03-04 14:07:03 +00:00
var entries := config.timesheet.entries
for item in entries:
print(item)
quit()
2023-03-03 21:44:32 +00:00
func stop() -> void:
2023-03-04 14:07:03 +00:00
if config.timesheet.current_entry:
config.timesheet.close_entry()
2023-03-03 21:44:32 +00:00
func start() -> void:
pass
func current() -> void:
2023-03-04 14:07:03 +00:00
if config.timesheet.current_entry:
print("{name}\t{start_time}\t{end_time}"%config.timesheet.current_entry)