Reformatted command prompt header and added relative paths.

This commit is contained in:
That-One-Nerd 2023-05-11 17:33:11 -04:00
parent 92b22d6749
commit 7854a576a7
2 changed files with 16 additions and 4 deletions

View File

@ -3,10 +3,12 @@
public class Mod
{
public string Name { get; set; }
public string RootDirectory { get; set; }
private Mod()
{
Name = string.Empty;
RootDirectory = string.Empty;
}
public static Mod? ReadDirectory(string dir)
@ -15,7 +17,8 @@ public class Mod
Mod mod = new()
{
Name = dir.Split("\\").Last()
Name = dir.Split("\\").Last(),
RootDirectory = dir
};
return mod;

View File

@ -139,9 +139,18 @@ public class Shell
public string ReadLine()
{
Write($"\n{WorkingDirectory}", ConsoleColor.DarkGreen, false);
if (ActiveGame is not null) Write($" {ActiveGame}", ConsoleColor.DarkYellow, false);
if (ActiveMod is not null) Write($" {ActiveMod}", ConsoleColor.Magenta, false);
Write("\n", newLine: false);
if (ActiveMod is not null) Write($"{ActiveMod} ", ConsoleColor.Magenta, false);
if (ActiveMod is not null)
{
string directory = Path.GetRelativePath(ActiveMod.RootDirectory, WorkingDirectory);
if (directory == ".") directory = string.Empty;
Write($"~\\{directory}", ConsoleColor.DarkGreen, false);
}
else Write($"{WorkingDirectory}", ConsoleColor.DarkGreen, false);
if (ActiveGame is not null) Write($" ({ActiveGame})", ConsoleColor.DarkYellow, false);
Write(null);
Write($" {Name}", ConsoleColor.DarkCyan, false);