コード例 #1
0
        /// <summary>
        /// Configure the builder by default from attributes.
        /// </summary>
        /// <param name="builder"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public static ICommandLineModuleManifestBuilder WithDefaultsFromModuleType(this ICommandLineModuleManifestBuilder builder, Type type)
        {
            if (type.IsDefined(typeof(CommandsFromAssemblyAttribute)))
            {
                builder.WithCommandsFromModuleAssembly(type);
            }

            var cmdAttrs = type.GetCustomAttributes <CommandFromAttribute>(true);

            foreach (var attr in cmdAttrs)
            {
                builder.AddCommand(attr.Type);
            }

            return(builder);
        }
コード例 #2
0
 /// <summary>
 /// Add a command type to manifest.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="builder"></param>
 /// <returns></returns>
 public static ICommandLineModuleManifestBuilder AddCommand <T>(this ICommandLineModuleManifestBuilder builder) where T : ICommand => builder.AddCommand(typeof(T));
コード例 #3
0
 /// <summary>
 /// Add commands from the assembly of module.
 /// </summary>
 /// <param name="builder"></param>
 /// <param name="type"></param>
 /// <returns></returns>
 public static ICommandLineModuleManifestBuilder WithCommandsFromModuleAssembly(this ICommandLineModuleManifestBuilder builder, Type type)
 {
コード例 #4
0
 /// <summary>
 /// Add a command type to manifest.
 /// </summary>
 /// <param name="builder"></param>
 /// <param name="type"></param>
 /// <returns></returns>
 public static ICommandLineModuleManifestBuilder AddCommand(this ICommandLineModuleManifestBuilder builder, Type type)
 {
     type.EnsureCommand();
     builder.Commands.Add(type);
     return(builder);
 }
コード例 #5
0
 /// <inheritdoc/>
 public virtual void ConfigureCommandLineModuleManifest(ICommandLineModuleManifestBuilder builder)
 {
 }