Exemplo n.º 1
0
        public static void Execute(string[] args, IOperations operations)
        {
            var commandLineApplication = new CommandLineApplication(false);

            var applyMigrate = commandLineApplication.Option(
                "--ef-migrate",
                "Apply entity framework migrations and exit",
                CommandOptionType.NoValue);

            var verifyMigrate = commandLineApplication.Option(
                "--ef-migrate-check",
                "Check the status of entity framework migrations",
                CommandOptionType.NoValue);

            var appSettingsDirectory = commandLineApplication.Option(
                "--appsettings-directory",
                "Directory to where the appsettings exist. The environment variable of aspnetcore will be checked to determine appsettings file.",
                CommandOptionType.SingleValue);

            operations.AddOption(commandLineApplication);

            commandLineApplication.HelpOption("-? | -h | --help");

            commandLineApplication.OnExecute(() =>
            {
                ExecuteApp(applyMigrate, verifyMigrate, appSettingsDirectory, operations);
                return(0);
            });

            commandLineApplication.Execute(args);
        }