From 1449292e53865624f3b7ce79957da175e8b8dff7 Mon Sep 17 00:00:00 2001 From: glax Date: Sat, 20 May 2023 16:35:08 +0200 Subject: [PATCH] More fancy CLI --- Tranga-CLI/Tranga_Cli.cs | 22 ++++++++++++---------- Tranga/TrangaTask.cs | 2 +- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Tranga-CLI/Tranga_Cli.cs b/Tranga-CLI/Tranga_Cli.cs index 333155a..81e6fb9 100644 --- a/Tranga-CLI/Tranga_Cli.cs +++ b/Tranga-CLI/Tranga_Cli.cs @@ -127,15 +127,14 @@ public static class Tranga_Cli int taskEnqueuedCount = taskManager.GetAllTasks().Count(task => task.state == TrangaTask.ExecutionState.Enqueued); Console.Clear(); - Console.WriteLine($"Download Folder: {folderPath} Tasks (Running/Queue/Total): {taskRunningCount}/{taskEnqueuedCount}/{taskCount}"); - Console.WriteLine("U: Update this Screen"); - Console.WriteLine("L: List tasks"); - Console.WriteLine("C: Create Task"); - Console.WriteLine("D: Delete Task"); - Console.WriteLine("E: Execute Task now"); - Console.WriteLine("S: Search Task"); - Console.WriteLine("R: Running Tasks"); - Console.WriteLine("Q: Exit"); + Console.WriteLine($"Download Folder: {folderPath}"); + Console.WriteLine($"Tasks (Running/Queue/Total));: {taskRunningCount}/{taskEnqueuedCount}/{taskCount}"); + Console.WriteLine(); + Console.WriteLine($"{"C: Create Task",-30}{"L: List tasks",-30}"); + Console.WriteLine($"{"D: Delete Task",-30}{"R: List Running Tasks", -30}"); + Console.WriteLine($"{"E: Execute Task now",-30}{"S: Search Tasks", -30}"); + Console.WriteLine(); + Console.WriteLine($"{"U: Update this Screen",-30}{"Q: Exit",-30}"); ConsoleKey selection = Console.ReadKey().Key; Console.WriteLine(); return selection; @@ -149,7 +148,10 @@ public static class Tranga_Cli Console.Clear(); int tIndex = 0; Console.WriteLine($"Tasks (Running/Queue/Total): {taskRunningCount}/{taskEnqueuedCount}/{taskCount}"); - Console.WriteLine($"{"",-5}{"Task",-20} {"Last Executed",-20} {"Reoccurrence",-12} {"State",-10} {"Connector",-15} Publication/Manga"); + string header = + $"{"",-5}{"Task",-20} | {"Last Executed",-20} | {"Reoccurrence",-12} | {"State",-10} | {"Connector",-15} | Publication/Manga"; + Console.WriteLine(header); + Console.WriteLine(new string('-', header.Length)); foreach(TrangaTask trangaTask in tasks) Console.WriteLine($"{tIndex++:000}: {trangaTask}"); } diff --git a/Tranga/TrangaTask.cs b/Tranga/TrangaTask.cs index 7a0b537..d8b7788 100644 --- a/Tranga/TrangaTask.cs +++ b/Tranga/TrangaTask.cs @@ -56,6 +56,6 @@ public class TrangaTask public override string ToString() { - return $"{task,-20} {lastExecuted,-20} {reoccurrence,-12} {state,-10} {connectorName,-15} {publication?.sortName}"; + return $"{task,-20} | {lastExecuted,-20} | {reoccurrence,-12} | {state,-10} | {connectorName,-15} | {publication?.sortName}"; } } \ No newline at end of file