CommandContext
A class in Root.Township, Alta.Console.
Who ran a console command and with what: the calling user, their group permissions, the raw text and a selection. Passed to requirement checks.
- Listed in Console, logging and analytics
- Documented in Writing commands
Constructors
| Member | What it is |
|---|---|
CommandContext(UserInfoWithPermissions user) | Creates a CommandContext from user and groupPermissions. |
CommandContext(UserInfoWithPermissions user, IEnumerable<GroupPermissions> groupPermissions) | Creates a CommandContext from user and groupPermissions. |
Properties
| Member | What it is |
|---|---|
UserInfoWithPermissions CallingUser { get; } | The user who ran the command, with their permissions. |
DateTime CreationTime { get; } | When the context was made. |
IEnumerable<GroupPermissions> GroupPermissions { get; } | The caller's group permissions; empty if none were given. |
string RawCommand { get; set; } | The command text as typed. |
AltaSelection Selection { get; } | Selection state commands can read or change. |
Used in
Members of other types that take, return or hold a CommandContext:
Command.GetCommandPartInternal, Command.GetCommandsInternal, CommandCollection.GetParts, CommandCollection.Search, CommandContextExtensions.GetDebugInfo, CommandPart.GetCommandPart, CommandPart.GetCommandPartInternal, CommandPart.GetCommands, CommandPart.GetCommandsInternal, CommandPart.RequirementsAreMet, CommandService.CurrentContext, CommandService.defaultContext, CommandService.Handle, CommandService.Search, GroupPermissionAttribute.Check, Module.GetCommandPartInternal, Module.GetCommandsInternal, NonSimpleServerAttribute.Check, NotAllowedInRemoteAttribute.Check, RequirementAttribute.Check, WebSocketCommandHandler.context, WithGroupPermissionsOnlyAttribute.Check, WithPermissionOnlyAttribute.Check.