Roleban completions (#9114)

* Roleban completions

* helpers

* eat my peenor dumb robot
This commit is contained in:
Kara
2022-06-24 04:14:47 -07:00
committed by GitHub
parent 7a9bd79263
commit 4d8ff35640
4 changed files with 91 additions and 8 deletions

View File

@@ -1,6 +1,8 @@
using System.Text;
using System.Linq;
using System.Text;
using Content.Server.Database;
using Content.Shared.Administration;
using Robust.Server.Player;
using Robust.Shared.Console;
namespace Content.Server.Administration.Commands;
@@ -9,8 +11,8 @@ namespace Content.Server.Administration.Commands;
public sealed class RoleBanListCommand : IConsoleCommand
{
public string Command => "rolebanlist";
public string Description => "Lists the user's role bans";
public string Help => "Usage: <name or user ID> [include unbanned]";
public string Description => Loc.GetString("cmd-rolebanlist-desc");
public string Help => Loc.GetString("cmd-rolebanlist-help");
public async void Execute(IConsoleShell shell, string argStr, string[] args)
{
@@ -88,4 +90,16 @@ public sealed class RoleBanListCommand : IConsoleCommand
shell.WriteLine(bansString.ToString());
}
public CompletionResult GetCompletion(IConsoleShell shell, string[] args)
{
return args.Length switch
{
1 => CompletionResult.FromHintOptions(CompletionHelper.SessionNames(),
Loc.GetString("cmd-rolebanlist-hint-1")),
2 => CompletionResult.FromHintOptions(CompletionHelper.Booleans,
Loc.GetString("cmd-rolebanlist-hint-2")),
_ => CompletionResult.Empty
};
}
}