Пример #1
0
        public static Command CreateUndeployCommand()
        {
            var command = new Command("undeploy", "delete deployed application")
            {
                CommonArguments.Path_Required,
                StandardOptions.Interactive,
                StandardOptions.Verbosity,

                new Option(new[] { "--what-if", }, "print what would be deleted without making changes")
                {
                    Argument = new Argument <bool>(),
                },
            };

            command.Handler = CommandHandler.Create <IConsole, FileInfo, Verbosity, bool, bool>((console, path, verbosity, interactive, whatIf) =>
            {
                // 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(UndeployHost.UndeployAsync(console, path, verbosity, interactive, whatIf));
            });

            return(command);
        }
Пример #2
0
        public static Command CreateUndeployCommand()
        {
            var command = new Command("undeploy", "delete deployed application")
            {
                CommonArguments.Path_Required,
                StandardOptions.Namespace,
                StandardOptions.Interactive,
                StandardOptions.Verbosity,
                StandardOptions.Tags,

                new Option(new[] { "--what-if", }, "print what would be deleted without making changes")
                {
                    Argument = new Argument <bool>(),
                },
            };

            command.Handler = CommandHandler.Create <UndeployCommandArguments>(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(UndeployHost.UndeployAsync(output, args.Path, args.Namespace, args.Interactive, args.WhatIf, filter));
            });

            return(command);
        }