rat-times/main.gd

35 lines
688 B
GDScript

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