mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Changed return type to ExitCode
This commit is contained in:
parent
fd66313858
commit
3ae5ef6d83
@ -8,7 +8,7 @@ using Wabbajack.Common;
|
||||
|
||||
namespace Wabbajack.CLI
|
||||
{
|
||||
internal enum ExitCode
|
||||
public enum ExitCode
|
||||
{
|
||||
BadArguments = -1,
|
||||
Ok = 0,
|
||||
@ -182,10 +182,10 @@ namespace Wabbajack.CLI
|
||||
Console.Write(msg);
|
||||
}
|
||||
|
||||
internal static int Exit(string msg, ExitCode code)
|
||||
internal static ExitCode Exit(string msg, ExitCode code)
|
||||
{
|
||||
Log(msg);
|
||||
return (int)code;
|
||||
return code;
|
||||
}
|
||||
|
||||
internal static void LogException(Exception e, string msg)
|
||||
|
@ -10,10 +10,9 @@ namespace Wabbajack.CLI.Verbs
|
||||
CLIUtils.Exit("The provided arguments are not valid! Check previous messages for more information",
|
||||
ExitCode.BadArguments);
|
||||
|
||||
return Run().Result;
|
||||
return (int)Run().Result;
|
||||
}
|
||||
|
||||
protected abstract Task<int> Run();
|
||||
|
||||
protected abstract Task<ExitCode> Run();
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ namespace Wabbajack.CLI.Verbs
|
||||
}
|
||||
}
|
||||
|
||||
protected override async Task<int> Run()
|
||||
protected override async Task<ExitCode> Run()
|
||||
{
|
||||
if (Modlist != null && (!Modlist.EndsWith(Consts.ModListExtension) && !Modlist.EndsWith("modlist.txt")))
|
||||
return CLIUtils.Exit($"The file {Modlist} is not a valid modlist file!", ExitCode.BadArguments);
|
||||
|
@ -14,7 +14,7 @@ namespace Wabbajack.CLI.Verbs
|
||||
[Option('o', "output", Required = true, HelpText = @"Output file for the decrypted data")]
|
||||
public string? Output { get; set; }
|
||||
|
||||
protected override async Task<int> Run()
|
||||
protected override async Task<ExitCode> Run()
|
||||
{
|
||||
File.WriteAllBytes(Output, Utils.FromEncryptedData(Name));
|
||||
return 0;
|
||||
|
@ -11,7 +11,7 @@ namespace Wabbajack.CLI.Verbs
|
||||
[Option('n', "name", Required = true, HelpText = @"Full name (as returned by my-files) of the file")]
|
||||
public string? Name { get; set; }
|
||||
|
||||
protected override async Task<int> Run()
|
||||
protected override async Task<ExitCode> Run()
|
||||
{
|
||||
Console.WriteLine(await AuthorAPI.DeleteFile(Name));
|
||||
return 0;
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Reactive.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Alphaleonis.Win32.Filesystem;
|
||||
@ -19,7 +18,7 @@ namespace Wabbajack.CLI.Verbs
|
||||
[Option('o', "output", Required = true, HelpText = "Output file name")]
|
||||
public string? Output { get; set; }
|
||||
|
||||
protected override async Task<int> Run()
|
||||
protected override async Task<ExitCode> Run()
|
||||
{
|
||||
var state = await DownloadDispatcher.Infer(Url);
|
||||
if (state == null)
|
||||
|
@ -15,7 +15,7 @@ namespace Wabbajack.CLI.Verbs
|
||||
[Option('i', "input", Required = true, HelpText = @"Source data file name")]
|
||||
public string? Input { get; set; }
|
||||
|
||||
protected override async Task<int> Run()
|
||||
protected override async Task<ExitCode> Run()
|
||||
{
|
||||
File.ReadAllBytes(Input).ToEcryptedData(Name);
|
||||
return 0;
|
||||
|
@ -8,7 +8,7 @@ namespace Wabbajack.CLI.Verbs
|
||||
[Verb("my-files", HelpText = "List files I have uploaded to the CDN (requires Author API key)")]
|
||||
public class MyFiles : AVerb
|
||||
{
|
||||
protected override async Task<int> Run()
|
||||
protected override async Task<ExitCode> Run()
|
||||
{
|
||||
var files = await AuthorAPI.GetMyFiles();
|
||||
foreach (var file in files)
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using CommandLine;
|
||||
using Wabbajack.Lib.FileUploader;
|
||||
@ -9,7 +8,7 @@ namespace Wabbajack.CLI.Verbs
|
||||
[Verb("server-log", HelpText = @"Get the latest server log entries", Hidden = false)]
|
||||
public class ServerLog : AVerb
|
||||
{
|
||||
protected override async Task<int> Run()
|
||||
protected override async Task<ExitCode> Run()
|
||||
{
|
||||
Console.WriteLine(await AuthorAPI.GetServerLog());
|
||||
return 0;
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
using CommandLine;
|
||||
using Wabbajack.Lib.FileUploader;
|
||||
|
||||
@ -8,7 +7,7 @@ namespace Wabbajack.CLI.Verbs
|
||||
[Verb("update-server-modlists", HelpText = "Tell the Build server to update curated modlists (Requires Author API key)")]
|
||||
public class UpdateModlists : AVerb
|
||||
{
|
||||
protected override async Task<int> Run()
|
||||
protected override async Task<ExitCode> Run()
|
||||
{
|
||||
CLIUtils.Log($"Job ID: {await AuthorAPI.UpdateServerModLists()}");
|
||||
return 0;
|
||||
|
@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
using CommandLine;
|
||||
using Wabbajack.Common;
|
||||
using Wabbajack.Lib.FileUploader;
|
||||
|
||||
namespace Wabbajack.CLI.Verbs
|
||||
@ -9,7 +7,7 @@ namespace Wabbajack.CLI.Verbs
|
||||
[Verb("update-nexus-cache", HelpText = "Tell the build server to update the Nexus cache (requires Author API key)")]
|
||||
public class UpdateNexusCache : AVerb
|
||||
{
|
||||
protected override async Task<int> Run()
|
||||
protected override async Task<ExitCode> Run()
|
||||
{
|
||||
CLIUtils.Log($"Job ID: {await AuthorAPI.UpdateNexusCache()}");
|
||||
return 0;
|
||||
|
@ -18,7 +18,7 @@ namespace Wabbajack.CLI.Verbs
|
||||
/// Runs the Validation of a Modlist
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected override async Task<int> Run()
|
||||
protected override async Task<ExitCode> Run()
|
||||
{
|
||||
ModList modlist;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user