1
0

OpenAHelpCommand.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using Content.Client.UserInterface.Systems.Bwoink;
  2. using Content.Shared.Administration;
  3. using Robust.Client.UserInterface;
  4. using Robust.Shared.Console;
  5. using Robust.Shared.Network;
  6. namespace Content.Client.Commands;
  7. [AnyCommand]
  8. public sealed class OpenAHelpCommand : LocalizedCommands
  9. {
  10. [Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
  11. public override string Command => "openahelp";
  12. public override string Help => LocalizationManager.GetString($"cmd-{Command}-help", ("command", Command));
  13. public override void Execute(IConsoleShell shell, string argStr, string[] args)
  14. {
  15. if (args.Length >= 2)
  16. {
  17. shell.WriteLine(Help);
  18. return;
  19. }
  20. if (args.Length == 0)
  21. {
  22. _userInterfaceManager.GetUIController<AHelpUIController>().Open();
  23. }
  24. else
  25. {
  26. if (Guid.TryParse(args[0], out var guid))
  27. {
  28. var targetUser = new NetUserId(guid);
  29. _userInterfaceManager.GetUIController<AHelpUIController>().Open(targetUser);
  30. }
  31. else
  32. {
  33. shell.WriteError(LocalizationManager.GetString($"cmd-{Command}-error"));
  34. }
  35. }
  36. }
  37. }