mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-25 05:56:58 +01:00
Add delete command to CLI
This commit is contained in:
@@ -10,13 +10,40 @@ namespace TGCommandLine
|
||||
public ConfigCommand()
|
||||
{
|
||||
Keyword = "config";
|
||||
Children = new Command[] { new ConfigServerDirectoryCommand(), new ConfigDownloadCommand(), new ConfigUploadCommand(), new ConfigListCommand() };
|
||||
Children = new Command[] { new ConfigDeleteCommand(), new ConfigServerDirectoryCommand(), new ConfigDownloadCommand(), new ConfigUploadCommand(), new ConfigListCommand() };
|
||||
}
|
||||
public override string GetHelpText()
|
||||
{
|
||||
return "Manage settings";
|
||||
}
|
||||
}
|
||||
class ConfigDeleteCommand : Command
|
||||
{
|
||||
public ConfigDeleteCommand()
|
||||
{
|
||||
Keyword = "delete";
|
||||
RequiredParameters = 1;
|
||||
}
|
||||
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var res = Server.GetComponent<ITGConfig>().DeleteFile(parameters[0], out bool unauthorized);
|
||||
if (res != null)
|
||||
{
|
||||
OutputProc(res);
|
||||
return ExitCode.ServerError;
|
||||
}
|
||||
return ExitCode.Normal;
|
||||
}
|
||||
public override string GetArgumentString()
|
||||
{
|
||||
return "<static file>";
|
||||
}
|
||||
public override string GetHelpText()
|
||||
{
|
||||
return "Deletes the specified file from the static tree.";
|
||||
}
|
||||
}
|
||||
|
||||
class ConfigListCommand : Command
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user