You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Alex Hagl edited this page Nov 24, 2023
·
2 revisions
How to use it
To register a new command, make sure it is present in the AvailableCommands Enum. Then implement a Controller for the command:
[SessionOnly]publicclassFooController:IController{publicExitConditionHandle(string[]args){// Your code goes here}}
The SessionOnly attribute secures the controller, so the user has to be logged in into an active session.
To gain further information about the user, inject the CliEnvironment class into your controller via DI.
To register your controller go to the RunnerExtensions file and first add your Controller to DI:
The controller type gets added into an Array, storing all controllers indexed by their enum value.
When a user inputs a command, it gets parsed, the type gets fetched from the array, the controller gets instantiated by the ServiceProvider and finally the Controller Handle function gets executed.
If the commmand entered is not specified, the command parser defaults to AvailableCommands.HELP