Add delete command to CLI

This commit is contained in:
Cyberboss
2017-09-21 14:53:19 -04:00
parent e3f9737f24
commit 49bca6a527
+28 -1
View File
@@ -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
{