-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.Threading.Tasks; | ||
using Spectre.Console.Cli; | ||
using Spectre.Console; | ||
using Stargazer.Dbus; | ||
|
||
namespace Stargazer.Commands { | ||
public class Verify : AsyncCommand<VerifySettings> { | ||
public override async Task<int> ExecuteAsync(CommandContext context, VerifySettings settings) { | ||
await DbusClient.ConnectAsync(); | ||
|
||
ValidityReport validity = await DbusClient.VerifyAsync(settings.profile); | ||
|
||
AnsiConsole.Write("Verifying {0}...", settings.profile); | ||
|
||
if (validity.repaired) { | ||
AnsiConsole.WriteLine("\rVerifying {0} (Passed)", settings.profile); | ||
} else { | ||
AnsiConsole.WriteLine("\rVerifying {0} (Failed)", settings.profile); | ||
} | ||
|
||
Mod[] mods = await DbusClient.ListModsAsync(settings.profile); | ||
|
||
if (validity.missingDependencies.Length > 0) { | ||
AnsiConsole.WriteLine("Added missing dependencies:"); | ||
foreach (string dep in validity.missingDependencies) { | ||
Mod addedDep = mods.Where<Mod>(mod => mod.VersionId.Equals(dep)).First(); | ||
|
||
AnsiConsole.WriteLine(" {0} / {1}", addedDep.Title, addedDep.ModVersion); | ||
} | ||
} | ||
|
||
if (validity.incompatible.Length > 0) { | ||
AnsiConsole.WriteLine("Incompatible mods that were removed:"); | ||
foreach (Mod incompatible in validity.incompatible) { | ||
AnsiConsole.WriteLine(" {0} / {1}", incompatible.Title, incompatible.ModVersion); | ||
} | ||
} | ||
|
||
return 0; | ||
} | ||
} | ||
public class VerifySettings : CommandSettings { | ||
[CommandArgument(0, "<PROFILE>")] | ||
public string profile { get; set; } | ||
} | ||
} |