mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-27 07:04:57 +01:00
Update CommandLine to use the new IServerInterface
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using TGS.Interface;
|
||||
using TGS.Interface.Components;
|
||||
|
||||
namespace TGS.CommandLine
|
||||
{
|
||||
class AdminCommand : InstanceRootCommand
|
||||
sealed class AdminCommand : RootCommand
|
||||
{
|
||||
public AdminCommand()
|
||||
{
|
||||
@@ -26,7 +25,7 @@ namespace TGS.CommandLine
|
||||
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var res = Interface.GetComponent<ITGAdministration>().RecreateStaticFolder();
|
||||
var res = Instance.Administration.RecreateStaticFolder();
|
||||
OutputProc(res ?? "Success");
|
||||
return res == null ? ExitCode.Normal : ExitCode.ServerError;
|
||||
}
|
||||
@@ -50,7 +49,7 @@ namespace TGS.CommandLine
|
||||
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var group = Interface.GetComponent<ITGAdministration>().GetCurrentAuthorizedGroup();
|
||||
var group = Instance.Administration.GetCurrentAuthorizedGroup();
|
||||
OutputProc(group ?? "ERROR");
|
||||
return group != null ? ExitCode.Normal : ExitCode.ServerError;
|
||||
}
|
||||
@@ -75,7 +74,7 @@ namespace TGS.CommandLine
|
||||
}
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var result = Interface.GetComponent<ITGAdministration>().SetAuthorizedGroup(parameters[0]);
|
||||
var result = Instance.Administration.SetAuthorizedGroup(parameters[0]);
|
||||
if(result != null)
|
||||
{
|
||||
OutputProc("Group set to: " + result);
|
||||
@@ -103,7 +102,7 @@ namespace TGS.CommandLine
|
||||
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var res = Interface.GetComponent<ITGAdministration>().SetAuthorizedGroup(null);
|
||||
var res = Instance.Administration.SetAuthorizedGroup(null);
|
||||
if(res != "ADMIN")
|
||||
{
|
||||
OutputProc("Failed to clear the group??? We are currently set to: " + res);
|
||||
|
||||
@@ -2,11 +2,10 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using TGS.Interface;
|
||||
using TGS.Interface.Components;
|
||||
|
||||
namespace TGS.CommandLine
|
||||
{
|
||||
class BYONDCommand : InstanceRootCommand
|
||||
class BYONDCommand : RootCommand
|
||||
{
|
||||
public BYONDCommand()
|
||||
{
|
||||
@@ -33,7 +32,7 @@ namespace TGS.CommandLine
|
||||
type = ByondVersion.Staged;
|
||||
else if (parameters[0].ToLower() == "--latest")
|
||||
type = ByondVersion.Latest;
|
||||
OutputProc(Interface.GetComponent<ITGByond>().GetVersion(type) ?? "Unistalled");
|
||||
OutputProc(Instance.Byond.GetVersion(type) ?? "Unistalled");
|
||||
return ExitCode.Normal;
|
||||
}
|
||||
public override string GetArgumentString()
|
||||
@@ -56,7 +55,7 @@ namespace TGS.CommandLine
|
||||
}
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
switch (Interface.GetComponent<ITGByond>().CurrentStatus())
|
||||
switch (Instance.Byond.CurrentStatus())
|
||||
{
|
||||
case ByondStatus.Downloading:
|
||||
OutputProc("Downloading update...");
|
||||
@@ -109,7 +108,7 @@ namespace TGS.CommandLine
|
||||
return ExitCode.BadCommand;
|
||||
}
|
||||
|
||||
var BYOND = Interface.GetComponent<ITGByond>();
|
||||
var BYOND = Instance.Byond;
|
||||
if (!BYOND.UpdateToVersion(Major, Minor))
|
||||
|
||||
{
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TGS.Interface;
|
||||
using TGS.Interface.Components;
|
||||
|
||||
namespace TGS.CommandLine
|
||||
{
|
||||
class IRCCommand : InstanceRootCommand
|
||||
class IRCCommand : RootCommand
|
||||
{
|
||||
public IRCCommand()
|
||||
{
|
||||
@@ -17,7 +16,7 @@ namespace TGS.CommandLine
|
||||
return "Manages the IRC bot";
|
||||
}
|
||||
}
|
||||
class DiscordCommand : InstanceRootCommand
|
||||
class DiscordCommand : RootCommand
|
||||
{
|
||||
public DiscordCommand()
|
||||
{
|
||||
@@ -48,7 +47,7 @@ namespace TGS.CommandLine
|
||||
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var Chat = Interface.GetComponent<ITGChat>();
|
||||
var Chat = Instance.Chat;
|
||||
Chat.SetProviderInfo(new IRCSetupInfo(Chat.ProviderInfos()[(int)ChatProvider.IRC])
|
||||
{
|
||||
Nickname = parameters[0],
|
||||
@@ -78,7 +77,7 @@ namespace TGS.CommandLine
|
||||
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var IRC = Interface.GetComponent<ITGChat>();
|
||||
var IRC = Instance.Chat;
|
||||
var info = IRC.ProviderInfos()[providerIndex];
|
||||
List<string> channels;
|
||||
|
||||
@@ -156,7 +155,7 @@ namespace TGS.CommandLine
|
||||
}
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var IRC = Interface.GetComponent<ITGChat>();
|
||||
var IRC = Instance.Chat;
|
||||
var info = IRC.ProviderInfos()[providerIndex];
|
||||
List<string> channels;
|
||||
|
||||
@@ -222,7 +221,7 @@ namespace TGS.CommandLine
|
||||
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var info = Interface.GetComponent<ITGChat>().ProviderInfos()[providerIndex];
|
||||
var info = Instance.Chat.ProviderInfos()[providerIndex];
|
||||
string authType;
|
||||
switch ((ChatProvider)providerIndex)
|
||||
{
|
||||
@@ -281,7 +280,7 @@ namespace TGS.CommandLine
|
||||
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var res = Interface.GetComponent<ITGChat>().Reconnect(providerIndex);
|
||||
var res = Instance.Chat.Reconnect(providerIndex);
|
||||
if (res != null)
|
||||
{
|
||||
OutputProc("Error: " + res);
|
||||
@@ -310,7 +309,7 @@ namespace TGS.CommandLine
|
||||
}
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var IRC = Interface.GetComponent<ITGChat>();
|
||||
var IRC = Instance.Chat;
|
||||
var info = IRC.ProviderInfos()[providerIndex];
|
||||
var newmin = parameters[0].ToLower();
|
||||
|
||||
@@ -355,7 +354,7 @@ namespace TGS.CommandLine
|
||||
}
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var IRC = Interface.GetComponent<ITGChat>();
|
||||
var IRC = Instance.Chat;
|
||||
var info = IRC.ProviderInfos()[(int)ChatProvider.IRC];
|
||||
var lowerparam = parameters[0].ToLower();
|
||||
if (lowerparam == "channel-mode")
|
||||
@@ -394,7 +393,7 @@ namespace TGS.CommandLine
|
||||
}
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var IRC = Interface.GetComponent<ITGChat>();
|
||||
var IRC = Instance.Chat;
|
||||
var info = IRC.ProviderInfos()[(int)ChatProvider.Discord];
|
||||
var lowerparam = parameters[0].ToLower();
|
||||
if (lowerparam == "role-id")
|
||||
@@ -433,7 +432,7 @@ namespace TGS.CommandLine
|
||||
}
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var IRC = Interface.GetComponent<ITGChat>();
|
||||
var IRC = Instance.Chat;
|
||||
var info = new IRCSetupInfo(IRC.ProviderInfos()[(int)ChatProvider.IRC]);
|
||||
switch (parameters[0])
|
||||
{
|
||||
@@ -482,7 +481,7 @@ namespace TGS.CommandLine
|
||||
}
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var IRC = Interface.GetComponent<ITGChat>();
|
||||
var IRC = Instance.Chat;
|
||||
var info = IRC.ProviderInfos()[providerIndex];
|
||||
var newmin = parameters[0].ToLower();
|
||||
|
||||
@@ -529,7 +528,7 @@ namespace TGS.CommandLine
|
||||
}
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var IRC = Interface.GetComponent<ITGChat>();
|
||||
var IRC = Instance.Chat;
|
||||
IRC.SetProviderInfo(new IRCSetupInfo(IRC.ProviderInfos()[(int)ChatProvider.IRC])
|
||||
{
|
||||
AuthTarget = parameters[0],
|
||||
@@ -551,7 +550,7 @@ namespace TGS.CommandLine
|
||||
}
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var IRC = Interface.GetComponent<ITGChat>();
|
||||
var IRC = Instance.Chat;
|
||||
IRC.SetProviderInfo(new IRCSetupInfo(IRC.ProviderInfos()[(int)ChatProvider.IRC])
|
||||
{
|
||||
AuthTarget = null,
|
||||
@@ -575,7 +574,7 @@ namespace TGS.CommandLine
|
||||
}
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var IRC = Interface.GetComponent<ITGChat>();
|
||||
var IRC = Instance.Chat;
|
||||
var info = IRC.ProviderInfos()[providerIndex];
|
||||
OutputProc("Currently configured channels:");
|
||||
OutputProc("Admin:");
|
||||
@@ -610,7 +609,7 @@ namespace TGS.CommandLine
|
||||
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var Chat = Interface.GetComponent<ITGChat>();
|
||||
var Chat = Instance.Chat;
|
||||
var info = Chat.ProviderInfos()[providerIndex];
|
||||
info.Enabled = true;
|
||||
var res = Chat.SetProviderInfo(info);
|
||||
@@ -638,7 +637,7 @@ namespace TGS.CommandLine
|
||||
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var Chat = Interface.GetComponent<ITGChat>();
|
||||
var Chat = Instance.Chat;
|
||||
var info = Chat.ProviderInfos()[providerIndex];
|
||||
info.Enabled = false;
|
||||
var res = Chat.SetProviderInfo(info);
|
||||
@@ -675,7 +674,7 @@ namespace TGS.CommandLine
|
||||
OutputProc("Invalid parameter!");
|
||||
return ExitCode.BadCommand;
|
||||
}
|
||||
var Chat = Interface.GetComponent<ITGChat>();
|
||||
var Chat = Instance.Chat;
|
||||
var PI = new IRCSetupInfo(Chat.ProviderInfos()[(int)ChatProvider.IRC])
|
||||
{
|
||||
URL = splits[0]
|
||||
@@ -713,7 +712,7 @@ namespace TGS.CommandLine
|
||||
}
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var Chat = Interface.GetComponent<ITGChat>();
|
||||
var Chat = Instance.Chat;
|
||||
var res = Chat.SetProviderInfo(new DiscordSetupInfo(Chat.ProviderInfos()[(int)ChatProvider.Discord]) { BotToken = parameters[0] });
|
||||
OutputProc(res ?? "Success");
|
||||
return res == null ? ExitCode.Normal : ExitCode.ServerError;
|
||||
|
||||
@@ -2,11 +2,10 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using TGS.Interface;
|
||||
using TGS.Interface.Components;
|
||||
|
||||
namespace TGS.CommandLine
|
||||
{
|
||||
class ConfigCommand : InstanceRootCommand
|
||||
class ConfigCommand : RootCommand
|
||||
{
|
||||
public ConfigCommand()
|
||||
{
|
||||
@@ -28,7 +27,7 @@ namespace TGS.CommandLine
|
||||
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var res = Interface.GetComponent<ITGConfig>().DeleteFile(parameters[0], out bool unauthorized);
|
||||
var res = Instance.Config.DeleteFile(parameters[0], out bool unauthorized);
|
||||
if (res != null)
|
||||
{
|
||||
OutputProc(res);
|
||||
@@ -64,7 +63,7 @@ namespace TGS.CommandLine
|
||||
}
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var list = Interface.GetComponent<ITGConfig>().ListStaticDirectory(parameters.Count > 0 ? parameters[0] : null, out string error, out bool unauthorized);
|
||||
var list = Instance.Config.ListStaticDirectory(parameters.Count > 0 ? parameters[0] : null, out string error, out bool unauthorized);
|
||||
if(list == null)
|
||||
{
|
||||
OutputProc(error);
|
||||
@@ -88,7 +87,7 @@ namespace TGS.CommandLine
|
||||
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
OutputProc(Interface.GetComponent<ITGInstance>().ServerDirectory());
|
||||
OutputProc(Instance.ServerDirectory());
|
||||
return ExitCode.Normal;
|
||||
}
|
||||
|
||||
@@ -108,7 +107,7 @@ namespace TGS.CommandLine
|
||||
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var bytes = Interface.GetComponent<ITGConfig>().ReadText(parameters[0], parameters.Count > 2 && parameters[2].ToLower() == "--repo", out string error, out bool unauthorized);
|
||||
var bytes = Instance.Config.ReadText(parameters[0], parameters.Count > 2 && parameters[2].ToLower() == "--repo", out string error, out bool unauthorized);
|
||||
if(bytes == null)
|
||||
{
|
||||
OutputProc("Error: " + error);
|
||||
@@ -148,7 +147,7 @@ namespace TGS.CommandLine
|
||||
{
|
||||
try
|
||||
{
|
||||
var res = Interface.GetComponent<ITGConfig>().WriteText(parameters[0], File.ReadAllText(parameters[1]), out bool unauthorized);
|
||||
var res = Instance.Config.WriteText(parameters[0], File.ReadAllText(parameters[1]), out bool unauthorized);
|
||||
if (res != null)
|
||||
{
|
||||
OutputProc("Error: " + res);
|
||||
|
||||
@@ -5,8 +5,12 @@ namespace TGS.CommandLine
|
||||
abstract class ConsoleCommand : Command
|
||||
{
|
||||
/// <summary>
|
||||
/// The <see cref="IServerInterface"/> currently in use by the <see cref="Program"/>
|
||||
/// The <see cref="IServer"/> currently in use by the <see cref="Program"/>
|
||||
/// </summary>
|
||||
public static IServerInterface Interface;
|
||||
public static IServer Server;
|
||||
/// <summary>
|
||||
/// The <see cref="IInstance"/> currently in use by the <see cref="Program"/>
|
||||
/// </summary>
|
||||
public static IInstance Instance;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TGS.Interface;
|
||||
using TGS.Interface.Components;
|
||||
|
||||
namespace TGS.CommandLine
|
||||
{
|
||||
class DDCommand : InstanceRootCommand
|
||||
class DDCommand : RootCommand
|
||||
{
|
||||
public DDCommand()
|
||||
{
|
||||
@@ -38,7 +37,7 @@ namespace TGS.CommandLine
|
||||
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var res = Interface.GetComponent<ITGDreamDaemon>().WorldAnnounce(String.Join(" ", parameters));
|
||||
var res = Instance.DreamDaemon.WorldAnnounce(String.Join(" ", parameters));
|
||||
OutputProc(res ?? "Success!");
|
||||
return res == null ? ExitCode.Normal : ExitCode.ServerError;
|
||||
}
|
||||
@@ -58,7 +57,7 @@ namespace TGS.CommandLine
|
||||
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var res = Interface.GetComponent<ITGDreamDaemon>().Start();
|
||||
var res = Instance.DreamDaemon.Start();
|
||||
OutputProc(res ?? "Success!");
|
||||
return res == null ? ExitCode.Normal : ExitCode.ServerError;
|
||||
}
|
||||
@@ -82,7 +81,7 @@ namespace TGS.CommandLine
|
||||
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var DD = Interface.GetComponent<ITGDreamDaemon>();
|
||||
var DD = Instance.DreamDaemon;
|
||||
if (parameters.Count > 0 && parameters[0].ToLower() == "--graceful")
|
||||
{
|
||||
if (DD.DaemonStatus() != DreamDaemonStatus.Online)
|
||||
@@ -111,7 +110,7 @@ namespace TGS.CommandLine
|
||||
}
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var DD = Interface.GetComponent<ITGDreamDaemon>();
|
||||
var DD = Instance.DreamDaemon;
|
||||
if (parameters.Count > 0 && parameters[0].ToLower() == "--graceful")
|
||||
{
|
||||
if (DD.DaemonStatus() != DreamDaemonStatus.Online)
|
||||
@@ -146,7 +145,7 @@ namespace TGS.CommandLine
|
||||
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var DD = Interface.GetComponent<ITGDreamDaemon>();
|
||||
var DD = Instance.DreamDaemon;
|
||||
OutputProc(DD.StatusString(true));
|
||||
if (DD.ShutdownInProgress())
|
||||
OutputProc("The server will shutdown once the current round completes.");
|
||||
@@ -167,7 +166,7 @@ namespace TGS.CommandLine
|
||||
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var DD = Interface.GetComponent<ITGDreamDaemon>();
|
||||
var DD = Instance.DreamDaemon;
|
||||
switch (parameters[0].ToLower())
|
||||
{
|
||||
case "on":
|
||||
@@ -205,7 +204,7 @@ namespace TGS.CommandLine
|
||||
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var DD = Interface.GetComponent<ITGDreamDaemon>();
|
||||
var DD = Instance.DreamDaemon;
|
||||
switch (parameters[0].ToLower())
|
||||
{
|
||||
case "on":
|
||||
@@ -255,7 +254,7 @@ namespace TGS.CommandLine
|
||||
return ExitCode.BadCommand;
|
||||
}
|
||||
|
||||
Interface.GetComponent<ITGDreamDaemon>().SetPort(port);
|
||||
Instance.DreamDaemon.SetPort(port);
|
||||
return ExitCode.Normal;
|
||||
}
|
||||
|
||||
@@ -298,7 +297,7 @@ namespace TGS.CommandLine
|
||||
OutputProc("Invalid security word!");
|
||||
return ExitCode.BadCommand;
|
||||
}
|
||||
Interface.GetComponent<ITGDreamDaemon>().SetSecurityLevel(sec);
|
||||
Instance.DreamDaemon.SetSecurityLevel(sec);
|
||||
return ExitCode.Normal;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,11 +2,10 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using TGS.Interface;
|
||||
using TGS.Interface.Components;
|
||||
|
||||
namespace TGS.CommandLine
|
||||
{
|
||||
class DMCommand : InstanceRootCommand
|
||||
class DMCommand : RootCommand
|
||||
{
|
||||
public DMCommand()
|
||||
{
|
||||
@@ -28,7 +27,7 @@ namespace TGS.CommandLine
|
||||
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var DM = Interface.GetComponent<ITGCompiler>();
|
||||
var DM = Instance.Compiler;
|
||||
var stat = DM.GetStatus();
|
||||
if (stat != CompilerStatus.Initialized)
|
||||
{
|
||||
@@ -36,7 +35,7 @@ namespace TGS.CommandLine
|
||||
return ExitCode.ServerError;
|
||||
}
|
||||
|
||||
if (Interface.GetComponent<ITGByond>().GetVersion(ByondVersion.Installed) == null)
|
||||
if (Instance.Byond.GetVersion(ByondVersion.Installed) == null)
|
||||
{
|
||||
Console.Write("Error: BYOND is not installed!");
|
||||
return ExitCode.ServerError;
|
||||
@@ -84,14 +83,14 @@ namespace TGS.CommandLine
|
||||
|
||||
void ShowError()
|
||||
{
|
||||
var error = Interface.GetComponent<ITGCompiler>().CompileError();
|
||||
var error = Instance.Compiler.CompileError();
|
||||
if (error != null)
|
||||
OutputProc("Last error: " + error);
|
||||
}
|
||||
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var DM = Interface.GetComponent<ITGCompiler>();
|
||||
var DM = Instance.Compiler;
|
||||
OutputProc(String.Format("Target Project: /{0}.dme", DM.ProjectName()));
|
||||
Console.Write("Compilier is currently: ");
|
||||
switch (DM.GetStatus())
|
||||
@@ -142,7 +141,7 @@ namespace TGS.CommandLine
|
||||
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
Interface.GetComponent<ITGCompiler>().SetProjectName(parameters[0]);
|
||||
Instance.Compiler.SetProjectName(parameters[0]);
|
||||
return ExitCode.Normal;
|
||||
}
|
||||
}
|
||||
@@ -166,7 +165,7 @@ namespace TGS.CommandLine
|
||||
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var DM = Interface.GetComponent<ITGCompiler>();
|
||||
var DM = Instance.Compiler;
|
||||
var stat = DM.GetStatus();
|
||||
if (stat == CompilerStatus.Compiling || stat == CompilerStatus.Initializing)
|
||||
{
|
||||
@@ -206,7 +205,7 @@ namespace TGS.CommandLine
|
||||
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var res = Interface.GetComponent<ITGCompiler>().Cancel();
|
||||
var res = Instance.Compiler.Cancel();
|
||||
OutputProc(res ?? "Success!");
|
||||
return ExitCode.Normal; //because failing cancellation implys it's already cancelled
|
||||
}
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using TGS.Interface;
|
||||
|
||||
namespace TGS.CommandLine
|
||||
{
|
||||
abstract class InstanceRootCommand : RootCommand
|
||||
{
|
||||
public static IServerInterface currentInterface;
|
||||
public override ExitCode DoRun(IList<string> parameters)
|
||||
{
|
||||
if (currentInterface.InstanceName == null)
|
||||
{
|
||||
OutputProc("Missing instance!");
|
||||
return ExitCode.BadCommand;
|
||||
}
|
||||
else
|
||||
{
|
||||
var res = currentInterface.ConnectToInstance();
|
||||
if (!res.HasFlag(ConnectivityLevel.Connected))
|
||||
{
|
||||
OutputProc("Unable to connect to instance!");
|
||||
return ExitCode.ConnectionError;
|
||||
}
|
||||
else if (!res.HasFlag(ConnectivityLevel.Authenticated))
|
||||
{
|
||||
OutputProc("The current user is not authorized to use this instance!");
|
||||
return ExitCode.ConnectionError;
|
||||
}
|
||||
}
|
||||
return base.DoRun(parameters);
|
||||
}
|
||||
}
|
||||
}
|
||||
+10
-12
@@ -84,7 +84,7 @@ namespace TGS.CommandLine
|
||||
}
|
||||
else if (interactive && !saidSrvVersion)
|
||||
{
|
||||
Console.WriteLine("Connectd to service version: " + currentInterface.GetServiceComponent<ITGLanding>().Version());
|
||||
Console.WriteLine("Connectd to service version: " + currentInterface.Server.Version);
|
||||
saidSrvVersion = true;
|
||||
}
|
||||
|
||||
@@ -102,8 +102,8 @@ namespace TGS.CommandLine
|
||||
static void ReplaceInterface(IServerInterface I)
|
||||
{
|
||||
currentInterface = I;
|
||||
ConsoleCommand.Interface = I;
|
||||
InstanceRootCommand.currentInterface = I;
|
||||
ConsoleCommand.Server = I.Server;
|
||||
ConsoleCommand.Instance = null;
|
||||
saidSrvVersion = false;
|
||||
}
|
||||
|
||||
@@ -156,20 +156,18 @@ namespace TGS.CommandLine
|
||||
/// </summary>
|
||||
/// <param name="instanceName">The name of the <see cref="ITGInstance"/> to test</param>
|
||||
/// <param name="silentSuccess">If <see langword="true"/>, does not output on success</param>
|
||||
/// <returns><see langword="true"/> if a <see cref="ConnectivityLevel.Authenticated"/> was achieved with <see cref="IServerInterface.ConnectToInstance(string, bool)"/>, <see langword="false"/> otherwise</returns>
|
||||
/// <returns><see langword="true"/> if the connection was made, <see langword="false"/> otherwise</returns>
|
||||
static bool CheckInstanceConnectivity(string instanceName, bool silentSuccess)
|
||||
{
|
||||
var res = currentInterface.ConnectToInstance(instanceName);
|
||||
if (!res.HasFlag(ConnectivityLevel.Connected))
|
||||
Console.WriteLine("Unable to connect to instance! Does it exist?");
|
||||
else if (!res.HasFlag(ConnectivityLevel.Authenticated))
|
||||
Console.WriteLine("The current user is not authorized to use this instance!");
|
||||
else
|
||||
var res = currentInterface.Server.Instances.Where(x => x.Metadata.Name == instanceName).FirstOrDefault();
|
||||
if (res != null)
|
||||
{
|
||||
if(!silentSuccess)
|
||||
ConsoleCommand.Instance = res;
|
||||
if (!silentSuccess)
|
||||
Console.WriteLine("Successfully conected to instance!");
|
||||
return true;
|
||||
}
|
||||
Console.WriteLine("Unable to connect to instance! Does it exist?");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -262,7 +260,7 @@ namespace TGS.CommandLine
|
||||
case "exit":
|
||||
return (int)Command.ExitCode.Normal;
|
||||
case "debug-upgrade":
|
||||
currentInterface.GetServiceComponent<ITGSService>().PrepareForUpdate();
|
||||
currentInterface.Server.Management.PrepareForUpdate();
|
||||
return (int)Command.ExitCode.Normal;
|
||||
default:
|
||||
//linq voodoo to get quoted strings
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TGS.Interface;
|
||||
using TGS.Interface.Components;
|
||||
|
||||
namespace TGS.CommandLine
|
||||
{
|
||||
@@ -40,10 +39,10 @@ namespace TGS.CommandLine
|
||||
switch (parameters[0].ToLower())
|
||||
{
|
||||
case "on":
|
||||
Interface.GetComponent<ITGRepository>().SetPushTestmergeCommits(true);
|
||||
Instance.Repository.SetPushTestmergeCommits(true);
|
||||
break;
|
||||
case "off":
|
||||
Interface.GetComponent<ITGRepository>().SetPushTestmergeCommits(false);
|
||||
Instance.Repository.SetPushTestmergeCommits(false);
|
||||
break;
|
||||
default:
|
||||
OutputProc("Invalid option!");
|
||||
@@ -67,7 +66,7 @@ namespace TGS.CommandLine
|
||||
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var res = Interface.GetComponent<ITGRepository>().UpdateTGS3Json();
|
||||
var res = Instance.Repository.UpdateTGS3Json();
|
||||
if (res != null)
|
||||
{
|
||||
OutputProc(res);
|
||||
@@ -86,7 +85,7 @@ namespace TGS.CommandLine
|
||||
}
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var res = Interface.GetComponent<ITGRepository>().Setup(parameters[0], parameters.Count > 1 ? parameters[1] : "master");
|
||||
var res = Instance.Repository.Setup(parameters[0], parameters.Count > 1 ? parameters[1] : "master");
|
||||
if (res != null)
|
||||
{
|
||||
OutputProc("Error: " + res);
|
||||
@@ -113,7 +112,7 @@ namespace TGS.CommandLine
|
||||
}
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var Repo = Interface.GetComponent<ITGRepository>();
|
||||
var Repo = Instance.Repository;
|
||||
var busy = Repo.OperationInProgress();
|
||||
if (!busy)
|
||||
{
|
||||
@@ -167,7 +166,7 @@ namespace TGS.CommandLine
|
||||
}
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var result = Interface.GetComponent<ITGRepository>().Reset(parameters.Count > 0 && parameters[0].ToLower() == "--origin");
|
||||
var result = Instance.Repository.Reset(parameters.Count > 0 && parameters[0].ToLower() == "--origin");
|
||||
OutputProc(result ?? "Success!");
|
||||
return result == null ? ExitCode.Normal : ExitCode.ServerError;
|
||||
}
|
||||
@@ -203,7 +202,7 @@ namespace TGS.CommandLine
|
||||
OutputProc("Invalid parameter: " + parameters[0]);
|
||||
return ExitCode.BadCommand;
|
||||
}
|
||||
var res = Interface.GetComponent<ITGRepository>().Update(hard);
|
||||
var res = Instance.Repository.Update(hard);
|
||||
OutputProc(res ?? "Success");
|
||||
return res == null ? ExitCode.Normal : ExitCode.ServerError;
|
||||
}
|
||||
@@ -224,7 +223,7 @@ namespace TGS.CommandLine
|
||||
}
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var result = Interface.GetComponent<ITGRepository>().GenerateChangelog(out string error);
|
||||
var result = Instance.Repository.GenerateChangelog(out string error);
|
||||
OutputProc(error ?? "Success!");
|
||||
if (result != null)
|
||||
OutputProc(result);
|
||||
@@ -244,7 +243,7 @@ namespace TGS.CommandLine
|
||||
}
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var result = Interface.GetComponent<ITGRepository>().SynchronizePush();
|
||||
var result = Instance.Repository.SynchronizePush();
|
||||
if(result != null)
|
||||
OutputProc(result);
|
||||
return result == null ? ExitCode.Normal : ExitCode.ServerError;
|
||||
@@ -264,7 +263,7 @@ namespace TGS.CommandLine
|
||||
}
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
Interface.GetComponent<ITGRepository>().SetCommitterEmail(parameters[0]);
|
||||
Instance.Repository.SetCommitterEmail(parameters[0]);
|
||||
return ExitCode.Normal;
|
||||
}
|
||||
|
||||
@@ -286,7 +285,7 @@ namespace TGS.CommandLine
|
||||
}
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
Interface.GetComponent<ITGRepository>().SetCommitterName(parameters[0]);
|
||||
Instance.Repository.SetCommitterName(parameters[0]);
|
||||
return ExitCode.Normal;
|
||||
}
|
||||
public override string GetArgumentString()
|
||||
@@ -319,7 +318,7 @@ namespace TGS.CommandLine
|
||||
OutputProc("Invalid PR Number!");
|
||||
return ExitCode.BadCommand;
|
||||
}
|
||||
var res = Interface.GetComponent<ITGRepository>().MergePullRequest(PR);
|
||||
var res = Instance.Repository.MergePullRequest(PR);
|
||||
OutputProc(res ?? "Success");
|
||||
return res == null ? ExitCode.Normal : ExitCode.ServerError;
|
||||
}
|
||||
@@ -346,7 +345,7 @@ namespace TGS.CommandLine
|
||||
}
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var data = Interface.GetComponent<ITGRepository>().MergedPullRequests(out string error);
|
||||
var data = Instance.Repository.MergedPullRequests(out string error);
|
||||
if (data == null)
|
||||
{
|
||||
OutputProc(error);
|
||||
@@ -373,7 +372,7 @@ namespace TGS.CommandLine
|
||||
}
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var data = Interface.GetComponent<ITGRepository>().ListBackups(out string error);
|
||||
var data = Instance.Repository.ListBackups(out string error);
|
||||
if (data == null)
|
||||
{
|
||||
OutputProc(error);
|
||||
@@ -400,7 +399,7 @@ namespace TGS.CommandLine
|
||||
}
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var res = Interface.GetComponent<ITGRepository>().Checkout(parameters[0]);
|
||||
var res = Instance.Repository.Checkout(parameters[0]);
|
||||
OutputProc(res ?? "Success");
|
||||
return res == null ? ExitCode.Normal : ExitCode.ServerError;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TGS.Interface;
|
||||
using TGS.Interface.Components;
|
||||
|
||||
namespace TGS.CommandLine
|
||||
{
|
||||
@@ -10,9 +9,9 @@ namespace TGS.CommandLine
|
||||
public CLICommand(IServerInterface I)
|
||||
{
|
||||
var tmp = new List<Command> { new UpdateCommand(), new TestmergeCommand(), new RepoCommand(), new BYONDCommand(), new DMCommand(), new DDCommand(), new ConfigCommand(), new IRCCommand(), new DiscordCommand(), new AutoUpdateCommand(), new SetAutoUpdateCommand() };
|
||||
if (I.ConnectToInstance().HasFlag(ConnectivityLevel.Administrator))
|
||||
if (ConsoleCommand.Instance.Administration != null)
|
||||
tmp.Add(new AdminCommand());
|
||||
if (I.ConnectionStatus().HasFlag(ConnectivityLevel.Administrator))
|
||||
if (ConsoleCommand.Server.Management != null)
|
||||
tmp.Add(new ServiceCommand());
|
||||
Children = tmp.ToArray();
|
||||
}
|
||||
@@ -37,7 +36,7 @@ namespace TGS.CommandLine
|
||||
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var res = Interface.GetComponent<ITGRepository>().AutoUpdateInterval();
|
||||
var res = Instance.Repository.AutoUpdateInterval();
|
||||
OutputProc(res == 0 ? "OFF" : String.Format("Auto updating every {0} minutes", res));
|
||||
return ExitCode.Normal;
|
||||
}
|
||||
@@ -76,7 +75,7 @@ namespace TGS.CommandLine
|
||||
return ExitCode.BadCommand;
|
||||
}
|
||||
|
||||
Interface.GetComponent<ITGRepository>().SetAutoUpdateInterval(NewInterval);
|
||||
Instance.Repository.SetAutoUpdateInterval(NewInterval);
|
||||
return ExitCode.Normal;
|
||||
}
|
||||
|
||||
@@ -91,7 +90,7 @@ namespace TGS.CommandLine
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var gen_cl = parameters.Count > 1 && parameters[1].ToLower() == "--cl";
|
||||
var Repo = Interface.GetComponent<ITGRepository>();
|
||||
var Repo = Instance.Repository;
|
||||
switch (parameters[0].ToLower())
|
||||
{
|
||||
case "hard":
|
||||
@@ -126,7 +125,7 @@ namespace TGS.CommandLine
|
||||
OutputProc(res);
|
||||
}
|
||||
}
|
||||
var resu = Interface.GetComponent<ITGCompiler>().Compile(true);
|
||||
var resu = Instance.Compiler.Compile(true);
|
||||
OutputProc(resu ? "Compilation started!" : "Compilation could not be started!");
|
||||
return resu ? ExitCode.Normal : ExitCode.ServerError;
|
||||
}
|
||||
@@ -163,7 +162,7 @@ namespace TGS.CommandLine
|
||||
OutputProc("Invalid tesmerge #: " + parameters[0]);
|
||||
return ExitCode.BadCommand;
|
||||
}
|
||||
var Repo = Interface.GetComponent<ITGRepository>();
|
||||
var Repo = Instance.Repository;
|
||||
var res = Repo.MergePullRequest(tm);
|
||||
if (res != null)
|
||||
{
|
||||
@@ -176,7 +175,7 @@ namespace TGS.CommandLine
|
||||
OutputProc(res);
|
||||
return ExitCode.ServerError;
|
||||
}
|
||||
var resu = Interface.GetComponent<ITGCompiler>().Compile(true);
|
||||
var resu = Instance.Compiler.Compile(true);
|
||||
OutputProc(resu ? "Compilation started!" : "Compilation could not be started!");
|
||||
return resu ? ExitCode.Normal : ExitCode.ServerError;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace TGS.CommandLine
|
||||
/// <inheritdoc />
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var res = Interface.GetServiceComponent<ITGInstanceManager>().CreateInstance(parameters[0], parameters[1]);
|
||||
var res = Server.InstanceManager.CreateInstance(parameters[0], parameters[1]);
|
||||
if (res != null)
|
||||
{
|
||||
OutputProc(res);
|
||||
@@ -87,8 +87,8 @@ namespace TGS.CommandLine
|
||||
/// <inheritdoc />
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
foreach (var I in Interface.GetServiceComponent<ITGLanding>().ListInstances())
|
||||
OutputProc(String.Format("{0} ({1}):\t{2}{3}", I.Name, I.Path, I.Enabled ? "Online" : "Offline", I.Enabled ? String.Format(" ({0})", I.LoggingID) : ""));
|
||||
foreach (var I in Server.Instances)
|
||||
OutputProc(I.ToString());
|
||||
return ExitCode.Normal;
|
||||
}
|
||||
}
|
||||
@@ -122,7 +122,7 @@ namespace TGS.CommandLine
|
||||
/// <inheritdoc />
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var res = Interface.GetServiceComponent<ITGInstanceManager>().DetachInstance(parameters[0]);
|
||||
var res = Server.InstanceManager.DetachInstance(parameters[0]);
|
||||
if (res != null)
|
||||
{
|
||||
OutputProc(res);
|
||||
@@ -161,7 +161,7 @@ namespace TGS.CommandLine
|
||||
/// <inheritdoc />
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var res = Interface.GetServiceComponent<ITGInstanceManager>().ImportInstance(parameters[0]);
|
||||
var res = Server.InstanceManager.ImportInstance(parameters[0]);
|
||||
if (res != null)
|
||||
{
|
||||
OutputProc(res);
|
||||
@@ -193,7 +193,7 @@ namespace TGS.CommandLine
|
||||
/// <inheritdoc />
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var res = Interface.GetServiceComponent<ITGSService>().PythonPath();
|
||||
var res = Server.Management.PythonPath();
|
||||
if (res != null)
|
||||
{
|
||||
OutputProc(res);
|
||||
@@ -232,7 +232,7 @@ namespace TGS.CommandLine
|
||||
/// <inheritdoc />
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
Interface.GetServiceComponent<ITGSService>().SetPythonPath(parameters[0]);
|
||||
Server.Management.SetPythonPath(parameters[0]);
|
||||
return ExitCode.Normal;
|
||||
}
|
||||
}
|
||||
@@ -266,7 +266,7 @@ namespace TGS.CommandLine
|
||||
/// <inheritdoc />
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var res = Interface.GetServiceComponent<ITGInstanceManager>().SetInstanceEnabled(parameters[0], true);
|
||||
var res = Server.InstanceManager.SetInstanceEnabled(parameters[0], true);
|
||||
if (res != null)
|
||||
{
|
||||
OutputProc(res);
|
||||
@@ -305,7 +305,7 @@ namespace TGS.CommandLine
|
||||
/// <inheritdoc />
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var res = Interface.GetServiceComponent<ITGInstanceManager>().SetInstanceEnabled(parameters[0], false);
|
||||
var res = Server.InstanceManager.SetInstanceEnabled(parameters[0], false);
|
||||
if (res != null)
|
||||
{
|
||||
OutputProc(res);
|
||||
@@ -316,7 +316,7 @@ namespace TGS.CommandLine
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Command for calling <see cref="TGS.Interface.Components.ITGSService.RemoteAccessPort"/>
|
||||
/// Command for calling <see cref="ITGSService.RemoteAccessPort"/>
|
||||
/// </summary>
|
||||
class ServiceRemoteAccessPortCommand : ConsoleCommand
|
||||
{
|
||||
@@ -337,7 +337,7 @@ namespace TGS.CommandLine
|
||||
/// <inheritdoc />
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
OutputProc(Interface.GetServiceComponent<ITGSService>().RemoteAccessPort().ToString());
|
||||
OutputProc(Server.Management.RemoteAccessPort().ToString());
|
||||
return ExitCode.Normal;
|
||||
}
|
||||
}
|
||||
@@ -382,7 +382,7 @@ namespace TGS.CommandLine
|
||||
return ExitCode.BadCommand;
|
||||
}
|
||||
|
||||
var res = Interface.GetServiceComponent<ITGSService>().SetRemoteAccessPort(port);
|
||||
var res = Server.Management.SetRemoteAccessPort(port);
|
||||
if (res != null)
|
||||
{
|
||||
OutputProc(res);
|
||||
@@ -422,7 +422,7 @@ namespace TGS.CommandLine
|
||||
/// <inheritdoc />
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var res = Interface.GetServiceComponent<ITGInstanceManager>().RenameInstance(parameters[0], parameters[1]);
|
||||
var res = Server.InstanceManager.RenameInstance(parameters[0], parameters[1]);
|
||||
if (res != null)
|
||||
{
|
||||
OutputProc(res);
|
||||
|
||||
@@ -51,7 +51,6 @@
|
||||
<Compile Include="DDCommands.cs" />
|
||||
<Compile Include="DMCommands.cs" />
|
||||
<Compile Include="ChatCommands.cs" />
|
||||
<Compile Include="InstanceRootCommand.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="RepoCommands.cs" />
|
||||
|
||||
@@ -12,10 +12,10 @@ namespace TGS.CommandLine.Commands.Repository.Tests
|
||||
/// </summary>
|
||||
/// <param name="repo">The <see cref="ITGRepository"/> the resulting <see cref="IServerInterface.GetComponent{T}"/> should return</param>
|
||||
/// <returns>A mock <see cref="IServerInterface"/></returns>
|
||||
protected IServerInterface MockInterfaceToRepo(ITGRepository repo)
|
||||
protected IInstance MockInterfaceToRepo(ITGRepository repo)
|
||||
{
|
||||
var mock = new Mock<IServerInterface>();
|
||||
mock.Setup(foo => foo.GetComponent<ITGRepository>()).Returns(repo);
|
||||
var mock = new Mock<IInstance>();
|
||||
mock.Setup(foo => foo.Repository).Returns(repo);
|
||||
return mock.Object;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace TGS.CommandLine.Commands.Repository.Tests
|
||||
var ran = false;
|
||||
var repo = new Mock<ITGRepository>();
|
||||
repo.Setup(foo => foo.SetPushTestmergeCommits(true)).Callback(() => { ran = true; });
|
||||
ConsoleCommand.Interface = MockInterfaceToRepo(repo.Object);
|
||||
ConsoleCommand.Server = MockInterfaceToRepo(repo.Object);
|
||||
Assert.AreEqual(new RepoSetPushTestmergeCommitsCommand().DoRun(new List<string> { "on" }), Command.ExitCode.Normal);
|
||||
Assert.IsTrue(ran);
|
||||
}
|
||||
@@ -36,7 +36,7 @@ namespace TGS.CommandLine.Commands.Repository.Tests
|
||||
var ran = false;
|
||||
var repo = new Mock<ITGRepository>();
|
||||
repo.Setup(foo => foo.SetPushTestmergeCommits(false)).Callback(() => { ran = true; });
|
||||
ConsoleCommand.Interface = MockInterfaceToRepo(repo.Object);
|
||||
ConsoleCommand.Server = MockInterfaceToRepo(repo.Object);
|
||||
Assert.AreEqual(new RepoSetPushTestmergeCommitsCommand().DoRun(new List<string> { "off" }), Command.ExitCode.Normal);
|
||||
Assert.IsTrue(ran);
|
||||
}
|
||||
|
||||
@@ -32,13 +32,13 @@ namespace TGS.CommandLine.Commands.Repository.Tests
|
||||
var ran = false;
|
||||
var mock = GetDefaultMock();
|
||||
mock.Setup(foo => foo.PushTestmergeCommits()).Returns(false).Callback(() => ran = true);
|
||||
ConsoleCommand.Interface = MockInterfaceToRepo(mock.Object);
|
||||
ConsoleCommand.Instance = MockInterfaceToRepo(mock.Object);
|
||||
Assert.AreEqual(new RepoStatusCommand().DoRun(new List<string> { }), Command.ExitCode.Normal);
|
||||
Assert.IsTrue(ran);
|
||||
|
||||
ran = false;
|
||||
mock.Setup(foo => foo.PushTestmergeCommits()).Returns(true).Callback(() => ran = true);
|
||||
ConsoleCommand.Interface = MockInterfaceToRepo(mock.Object);
|
||||
ConsoleCommand.Instance = MockInterfaceToRepo(mock.Object);
|
||||
Assert.AreEqual(new RepoStatusCommand().DoRun(new List<string> { }), Command.ExitCode.Normal);
|
||||
Assert.IsTrue(ran);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user