Example #1
0
        internal Command(ICommandDispatcher dispatcher, ICommandExecutor executor, ICommandSource?source, string raw, IInputDissector?dissector = null)
        {
            this.source     = source;
            this.dispatcher = dispatcher;
            this.executor   = executor;
            this.raw        = raw;

            var inputDissector = dissector ?? new DefaultInputDissector();

            var dissection = inputDissector.Dissect(raw);

            label          = dissection.label;
            args           = dissection.args ?? new string[] { };
            representation = dispatcher.FindRepresentation(label);

            if (representation == null)
            {
                Console.WriteLine($"Couldn't find a representation of the command '{label}'");
            }
        }