diff options
| author | DemonKingSwarn <rockingswarn@gmail.com> | 2025-01-25 23:22:47 +0530 |
|---|---|---|
| committer | DemonKingSwarn <rockingswarn@gmail.com> | 2025-01-25 23:22:47 +0530 |
| commit | b8ca4d2b90aaf41111c90dc6fff1181d43474443 (patch) | |
| tree | 0c95082059091db41581ad259c52d52130569b5f /Program.cs | |
| parent | 50569b93d07893821e98f161139bc903201fa454 (diff) | |
| download | hypr-wellbeing-b8ca4d2b90aaf41111c90dc6fff1181d43474443.zip hypr-wellbeing-b8ca4d2b90aaf41111c90dc6fff1181d43474443.tar.gz | |
chore: UI added
Diffstat (limited to 'Program.cs')
| -rw-r--r-- | Program.cs | 49 |
1 files changed, 46 insertions, 3 deletions
@@ -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<string, string> data = new Dictionary<string, string>(); + + 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); + } + } } + } |
