예제 #1
0
        /// <summary>
        /// Register sub command for the command
        /// </summary>
        /// <param name="name">Command name</param>
        /// <param name="description">Command description for help.</param>
        /// <param name="configureCommand">Command configuration callback</param>
        /// <typeparam name="TCommandArguments">Type of callback arguments type.</typeparam>
        /// <returns>Self instance</returns>
        public CommandConfigurator <TArguments> RegisterCommand <TCommandArguments>(string name, string description,
                                                                                    Action <CommandConfigurator <TCommandArguments> > configureCommand)
        {
            _commandConfigurator.RegisterCommand(
                name,
                description,
                configurator =>
            {
                var commandConfigurator = new CommandConfigurator <TCommandArguments>(configurator);
                configureCommand.Invoke(
                    commandConfigurator
                    );
                commandConfigurator.RegisterArguments();
            });

            return(this);
        }
예제 #2
0
 public CommandRegisterer(CommandConfigurator commandConfigurator)
 {
     _commandConfigurator = commandConfigurator;
 }
예제 #3
0
 /// <summary>
 /// Creates new instance of CommandConfigurator&lt;TArguments&gt;
 /// </summary>
 /// <param name="commandConfigurator">Command configurator used internally to configure command.</param>
 public CommandConfigurator(CommandConfigurator commandConfigurator)
 {
     _commandConfigurator = commandConfigurator;
     _commandRegisterer   = new CommandRegisterer(commandConfigurator);
 }