mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-26 06:27:19 +01:00
Console command to enumerate static dir
This commit is contained in:
@@ -10,7 +10,7 @@ namespace TGCommandLine
|
||||
public ConfigCommand()
|
||||
{
|
||||
Keyword = "config";
|
||||
Children = new Command[] { new ConfigServerDirectoryCommand(), new ConfigDownloadCommand(), new ConfigUploadCommand() };
|
||||
Children = new Command[] { new ConfigServerDirectoryCommand(), new ConfigDownloadCommand(), new ConfigUploadCommand(), new ConfigListCommand() };
|
||||
}
|
||||
public override string GetHelpText()
|
||||
{
|
||||
@@ -18,6 +18,39 @@ namespace TGCommandLine
|
||||
}
|
||||
}
|
||||
|
||||
class ConfigListCommand : Command
|
||||
{
|
||||
public ConfigListCommand()
|
||||
{
|
||||
Keyword = "list";
|
||||
}
|
||||
|
||||
public override string GetHelpText()
|
||||
{
|
||||
return "Lists the contents of the server's static directory, optionally specifying a subdirectory";
|
||||
}
|
||||
|
||||
public override string GetArgumentString()
|
||||
{
|
||||
return "[path to subdirectory]";
|
||||
}
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var list = Server.GetComponent<ITGConfig>().ListStaticDirectory(parameters.Count > 0 ? parameters[0] : null, out string error);
|
||||
if(list == null)
|
||||
{
|
||||
OutputProc(error);
|
||||
return ExitCode.ServerError;
|
||||
}
|
||||
if (list.Count == 0)
|
||||
OutputProc("The static directory is empty!");
|
||||
else
|
||||
foreach (var I in list)
|
||||
OutputProc(I);
|
||||
return ExitCode.Normal;
|
||||
}
|
||||
}
|
||||
|
||||
class ConfigServerDirectoryCommand : Command
|
||||
{
|
||||
public ConfigServerDirectoryCommand()
|
||||
|
||||
Reference in New Issue
Block a user