diff --git a/Content.Server/Administration/Commands/OpenAdminNotesCommand.cs b/Content.Server/Administration/Commands/OpenAdminNotesCommand.cs index ae79aa52bb..cbe1e89e19 100644 --- a/Content.Server/Administration/Commands/OpenAdminNotesCommand.cs +++ b/Content.Server/Administration/Commands/OpenAdminNotesCommand.cs @@ -1,19 +1,19 @@ -using Content.Server.Administration.Notes; +using System.Linq; +using Content.Server.Administration.Notes; using Content.Shared.Administration; +using Robust.Server.Player; using Robust.Shared.Console; namespace Content.Server.Administration.Commands; [AdminCommand(AdminFlags.ViewNotes)] -public sealed class OpenAdminNotesCommand : IConsoleCommand +public sealed class OpenAdminNotesCommand : LocalizedCommands { public const string CommandName = "adminnotes"; - public string Command => CommandName; - public string Description => "Opens the admin notes panel."; - public string Help => $"Usage: {Command} "; + public override string Command => CommandName; - public async void Execute(IConsoleShell shell, string argStr, string[] args) + public override async void Execute(IConsoleShell shell, string argStr, string[] args) { if (shell.Player is not { } player) { @@ -33,17 +33,27 @@ public sealed class OpenAdminNotesCommand : IConsoleCommand if (dbGuid == null) { - shell.WriteError($"Unable to find {args[0]} netuserid"); + shell.WriteError(Loc.GetString("cmd-adminnotes-wrong-target", ("user", args[0]))); return; } notedPlayer = dbGuid.UserId; break; default: - shell.WriteError($"Invalid arguments.\n{Help}"); + shell.WriteError(Loc.GetString("cmd-adminnotes-args-error")); return; } await IoCManager.Resolve().OpenEui(player, notedPlayer); } + + public override CompletionResult GetCompletion(IConsoleShell shell, string[] args) + { + if (args.Length != 1) + return CompletionResult.Empty; + + var playerMgr = IoCManager.Resolve(); + var options = playerMgr.Sessions.Select(c => c.Name).OrderBy(c => c).ToArray(); + return CompletionResult.FromHintOptions(options, Loc.GetString("cmd-adminnotes-hint")); + } } diff --git a/Resources/Locale/en-US/administration/commands/adminnotes.ftl b/Resources/Locale/en-US/administration/commands/adminnotes.ftl new file mode 100644 index 0000000000..abeede4651 --- /dev/null +++ b/Resources/Locale/en-US/administration/commands/adminnotes.ftl @@ -0,0 +1,8 @@ +cmd-adminnotes-desc = Opens the admin notes panel of target player. +cmd-adminnotes-help = Usage: adminnotes + +cmd-adminnotes-wrong-target = Unable to find user '{$user}'. +cmd-adminnotes-args-error = Invalid arguments. + Usage: adminnotes + +cmd-adminnotes-hint = UserId OR Username