コード例 #1
0
        protected RootCommandBase(IConsole console)
            : base("root")
        {
            Console = console ?? throw new ArgumentNullException(nameof(console), "No console provided.");

            RegisterCommand(new ExitCommand(() => { RequestCloseEvent?.Invoke(this, new EventArgs()); }));
            RegisterCommand(new ClearCommand());
            RegisterCommand(new ScreenCommand(console));
            RegisterCommand(new CmdCommand());
            RegisterCommand(new PoshCommand());
            RegisterCommand(new ExecuteProcessCommand());
            RegisterCommand(new ExecuteCommand(this));

            WriteEvent += OnOutputEvent;

            console.Attach(this);
        }