Exemplo n.º 1
0
        /// <summary>
        /// Configures application to use specified factory method for creating new instances of <see cref="ICommand"/>.
        /// </summary>
        public static ICliApplicationBuilder UseCommandFactory(this ICliApplicationBuilder builder, Func <CommandSchema, ICommand> factoryMethod)
        {
            builder.GuardNotNull(nameof(builder));
            factoryMethod.GuardNotNull(nameof(factoryMethod));

            return(builder.UseCommandFactory(new DelegateCommandFactory(factoryMethod)));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Adds commands from specified assemblies to the application.
        /// </summary>
        public static ICliApplicationBuilder AddCommandsFrom(this ICliApplicationBuilder builder, IReadOnlyList <Assembly> commandAssemblies)
        {
            foreach (var commandAssembly in commandAssemblies)
            {
                builder.AddCommandsFrom(commandAssembly);
            }

            return(builder);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Adds multiple commands to the application.
        /// </summary>
        public static ICliApplicationBuilder AddCommands(this ICliApplicationBuilder builder, IReadOnlyList <Type> commandTypes)
        {
            foreach (var commandType in commandTypes)
            {
                builder.AddCommand(commandType);
            }

            return(builder);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Adds commands from specified assemblies to the application.
        /// </summary>
        public static ICliApplicationBuilder AddCommandsFrom(this ICliApplicationBuilder builder, IReadOnlyList <Assembly> commandAssemblies)
        {
            builder.GuardNotNull(nameof(builder));
            commandAssemblies.GuardNotNull(nameof(commandAssemblies));

            foreach (var commandAssembly in commandAssemblies)
            {
                builder.AddCommandsFrom(commandAssembly);
            }

            return(builder);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Adds multiple commands to the application.
        /// </summary>
        public static ICliApplicationBuilder AddCommands(this ICliApplicationBuilder builder, IReadOnlyList <Type> commandTypes)
        {
            builder.GuardNotNull(nameof(builder));
            commandTypes.GuardNotNull(nameof(commandTypes));

            foreach (var commandType in commandTypes)
            {
                builder.AddCommand(commandType);
            }

            return(builder);
        }
Exemplo n.º 6
0
 /// <summary>
 /// Configures application to use specified factory method for creating new instances of <see cref="ICommand"/>.
 /// </summary>
 public static ICliApplicationBuilder UseCommandFactory(this ICliApplicationBuilder builder, Func <CommandSchema, ICommand> factoryMethod) =>
 builder.UseCommandFactory(new DelegateCommandFactory(factoryMethod));
Exemplo n.º 7
0
 /// <summary>
 /// Adds commands from calling assembly to the application.
 /// </summary>
 public static ICliApplicationBuilder AddCommandsFromThisAssembly(this ICliApplicationBuilder builder) =>
 builder.AddCommandsFrom(Assembly.GetCallingAssembly());
Exemplo n.º 8
0
 /// <summary>
 /// Adds commands from calling assembly to the application.
 /// </summary>
 public static ICliApplicationBuilder AddCommandsFromThisAssembly(this ICliApplicationBuilder builder)
 {
     builder.GuardNotNull(nameof(builder));
     return(builder.AddCommandsFrom(Assembly.GetCallingAssembly()));
 }