From b8ca4d2b90aaf41111c90dc6fff1181d43474443 Mon Sep 17 00:00:00 2001 From: DemonKingSwarn Date: Sat, 25 Jan 2025 23:22:47 +0530 Subject: chore: UI added --- Program.cs | 49 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 3 deletions(-) (limited to 'Program.cs') diff --git a/Program.cs b/Program.cs index 31fe70e..79b0b5d 100644 --- a/Program.cs +++ b/Program.cs @@ -1,9 +1,52 @@ -using hyprwatch.Logger; +using System.IO; +using System.Runtime.InteropServices; +using hyprwatch.Logger; class Program { - static void Main(string[] args) + static void Main(string[] args) { - WatchLog.LogCreation(); + if (args.Length == 0 || args[0] != "-d" && args[0] != "--show") + { + Console.WriteLine("Usage: -d || --show"); + return; + } + + if(args[0] == "-d") + { + while(true) + { + WatchLog.LogCreation(); + System.Threading.Thread.Sleep(5000); + } + } + + if(args[0] == "--show") + { + Dictionary data = new Dictionary(); + + var date = WatchLog.GetDate(); + string filePath = Environment.GetEnvironmentVariable("HOME") + $"/.cache/hyprwatch/daily_data/{date}.csv"; + + var rawData = File.ReadAllLines(filePath); + + foreach(var line in rawData) + { + var parts = line.Split('\t'); + if(parts.Length >= 2) + { + string key = parts[1].TrimEnd(); + string value = parts[0]; + data[key] = value; + } + } + Console.WriteLine("{0,-30} {1,-30}", "App", "Time"); + Console.WriteLine(new string('-', 60)); + foreach (var entry in data) + { + Console.WriteLine("{0,-30} {1,-30}", entry.Key, entry.Value); + } + } } + } -- cgit v1.1