2
0

More fancy CLI

This commit is contained in:
glax 2023-05-20 16:35:08 +02:00
parent 67f3695be8
commit a6a2d20981
2 changed files with 13 additions and 11 deletions

View File

@ -127,15 +127,14 @@ public static class Tranga_Cli
int taskEnqueuedCount = int taskEnqueuedCount =
taskManager.GetAllTasks().Count(task => task.state == TrangaTask.ExecutionState.Enqueued); taskManager.GetAllTasks().Count(task => task.state == TrangaTask.ExecutionState.Enqueued);
Console.Clear(); Console.Clear();
Console.WriteLine($"Download Folder: {folderPath} Tasks (Running/Queue/Total): {taskRunningCount}/{taskEnqueuedCount}/{taskCount}"); Console.WriteLine($"Download Folder: {folderPath}");
Console.WriteLine("U: Update this Screen"); Console.WriteLine($"Tasks (Running/Queue/Total)): {taskRunningCount}/{taskEnqueuedCount}/{taskCount}");
Console.WriteLine("L: List tasks"); Console.WriteLine();
Console.WriteLine("C: Create Task"); Console.WriteLine($"{"C: Create Task",-30}{"L: List tasks",-30}");
Console.WriteLine("D: Delete Task"); Console.WriteLine($"{"D: Delete Task",-30}{"R: List Running Tasks", -30}");
Console.WriteLine("E: Execute Task now"); Console.WriteLine($"{"E: Execute Task now",-30}{"S: Search Tasks", -30}");
Console.WriteLine("S: Search Task"); Console.WriteLine();
Console.WriteLine("R: Running Tasks"); Console.WriteLine($"{"U: Update this Screen",-30}{"Q: Exit",-30}");
Console.WriteLine("Q: Exit");
ConsoleKey selection = Console.ReadKey().Key; ConsoleKey selection = Console.ReadKey().Key;
Console.WriteLine(); Console.WriteLine();
return selection; return selection;
@ -149,7 +148,10 @@ public static class Tranga_Cli
Console.Clear(); Console.Clear();
int tIndex = 0; int tIndex = 0;
Console.WriteLine($"Tasks (Running/Queue/Total): {taskRunningCount}/{taskEnqueuedCount}/{taskCount}"); 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) foreach(TrangaTask trangaTask in tasks)
Console.WriteLine($"{tIndex++:000}: {trangaTask}"); Console.WriteLine($"{tIndex++:000}: {trangaTask}");
} }

View File

@ -56,6 +56,6 @@ public class TrangaTask
public override string ToString() 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}";
} }
} }