public static Command CreateBuildCommand()
        {
            var command = new Command("build", "build containers for the application")
            {
                CommonArguments.Path_Required,
                StandardOptions.Interactive,
                StandardOptions.Tags,
                StandardOptions.Verbosity,
                StandardOptions.Framework,
            };

            command.Handler = CommandHandler.Create <BuildCommandArguments>(args =>
            {
                // Workaround for https://github.com/dotnet/command-line-api/issues/723#issuecomment-593062654
                if (args.Path is null)
                {
                    throw new CommandException("No project or solution file was found.");
                }

                var output = new OutputContext(args.Console, args.Verbosity);
                output.WriteInfoLine("Loading Application Details...");

                var filter = ApplicationFactoryFilter.GetApplicationFactoryFilter(args.Tags);

                return(BuildHost.BuildAsync(output, args.Path, args.Interactive, args.Framework, filter));
            });

            return(command);
        }
Exemple #2
0
        public static Command CreateBuildCommand()
        {
            var command = new Command("build", "build containers for the application")
            {
                CommonArguments.Path_Required,
                StandardOptions.Interactive,
                StandardOptions.Verbosity,
            };

            command.Handler = CommandHandler.Create <IConsole, FileInfo, Verbosity, bool>((console, path, verbosity, interactive) =>
            {
                // Workaround for https://github.com/dotnet/command-line-api/issues/723#issuecomment-593062654
                if (path is null)
                {
                    throw new CommandException("No project or solution file was found.");
                }

                return(BuildHost.BuildAsync(console, path, verbosity, interactive));
            });

            return(command);
        }