using System; using System.Collections.Generic; using CommandLine; namespace ET.Server { [ConsoleHandler(ConsoleMode.CreateRobot)] public class CreateRobotConsoleHandler: IConsoleHandler { public async ETTask Run(Fiber fiber, ModeContex contex, string content) { switch (content) { case ConsoleMode.CreateRobot: Log.Console("CreateRobot args error!"); break; default: CreateRobotArgs options = null; Parser.Default.ParseArguments(content.Split(' ')) .WithNotParsed(error => throw new Exception($"CreateRobotArgs error!")) .WithParsed(o => { options = o; }); break; } contex.Parent.RemoveComponent(); await ETTask.CompletedTask; } } }