Console completions (content side) (#8211)
This commit is contained in:
committed by
GitHub
parent
d09ea18de5
commit
ddb4c00816
@@ -1,3 +1,4 @@
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
@@ -110,5 +111,32 @@ namespace Content.Server.Administration.Commands
|
||||
targetPlayer.ConnectedClient.Disconnect(banDef.DisconnectMessage);
|
||||
}
|
||||
}
|
||||
|
||||
public CompletionResult GetCompletion(IConsoleShell shell, string[] args)
|
||||
{
|
||||
if (args.Length == 1)
|
||||
{
|
||||
var playerMgr = IoCManager.Resolve<IPlayerManager>();
|
||||
var options = playerMgr.ServerSessions.Select(c => c.Name).OrderBy(c => c).ToArray();
|
||||
return CompletionResult.FromHintOptions(options, "<name/user ID>");
|
||||
}
|
||||
|
||||
if (args.Length == 2)
|
||||
return CompletionResult.FromHint("<reason>");
|
||||
|
||||
if (args.Length == 3)
|
||||
{
|
||||
var durations = new CompletionOption[]
|
||||
{
|
||||
new("0", "Permanent"),
|
||||
new("1440", "1 day"),
|
||||
new("10080", "1 week"),
|
||||
};
|
||||
|
||||
return CompletionResult.FromHintOptions(durations, "[duration]");
|
||||
}
|
||||
|
||||
return CompletionResult.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user