/// <summary>
        /// Initializes a new instance of the <see cref="CommandLoop"/> class.
        /// </summary>
        /// <param name="commandResolver">The <see cref="CommandResolver"/> used to resolve
        /// instances of <see cref="ICommand"/>.</param>
        /// <param name="commandGroupMetadataFactory">The <see cref="CommandGroupMetadataFactory"/>
        /// used to retrieve instances of <see cref="CommandMetadata"/> from a group.</param>
        /// <exception cref="ArgumentNullException"><paramref name="commandResolver"/>, or
        /// <paramref name="commandGroupMetadataFactory"/> is <see langword="null"/>.
        /// </exception>
        public CommandLoop(
            CommandResolver commandResolver,
            CommandGroupMetadataFactory commandGroupMetadataFactory)
        {
            ParameterValidation.IsNotNull(commandResolver, nameof(commandResolver));
            ParameterValidation
            .IsNotNull(commandGroupMetadataFactory, nameof(commandGroupMetadataFactory));

            this.commandResolver             = commandResolver;
            this.commandGroupMetadataFactory = commandGroupMetadataFactory;
            this.cancellationTokenSource     = new CancellationTokenSource();
        }
Example #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HelpCommand"/> class.
        /// </summary>
        /// <param name="commandLoop">The <see cref="CommandLoop"/> that this
        /// <see cref="HelpCommand"/> will use to get the current command group from.</param>
        /// <param name="commandGroupMetadataFactory">The
        /// <see cref="CommandGroupMetadataFactory"/> to use to create a collection of
        /// instances of <see cref="CommandMetadata"/>.</param>
        /// <exception cref="ArgumentNullException"><paramref name="commandLoop"/>, or
        /// <paramref name="commandGroupMetadataFactory"/> is <see langword="null"/>.</exception>
        public HelpCommand(
            CommandLoop commandLoop,
            CommandGroupMetadataFactory commandGroupMetadataFactory)
        {
            ParameterValidation.IsNotNull(commandLoop, nameof(commandLoop));
            ParameterValidation.IsNotNull(
                commandGroupMetadataFactory,
                nameof(commandGroupMetadataFactory));

            this.commandLoop = commandLoop;
            this.commandGroupMetadataFactory = commandGroupMetadataFactory;
        }