示例#1
0
        //https://github.com/commandlineparser/commandline
        //https://github.com/dotnet/command-line-api

        public static int Main(string[] args)
        {
            var environmentService      = new EnvironmentService();
            var traceService            = new FileTraceService();
            var localVersionService     = new LocalVersionService(traceService);
            var migrationServiceFactory = new CLI.MigrationServiceFactory(traceService);
            var commandLineService      = new CommandLineService(migrationServiceFactory, localVersionService, environmentService, traceService);

            var resultCode = Parser.Default.ParseArguments <
                InitOption,
                RunOption,
                ListOption,
                NextVersionOption,
                VerifyOption,
                EraseOption,
                BaselineOption,
                RebaseOption>(args)
                             .MapResult(
                (InitOption opts) => Dispatch(commandLineService.RunInitOption, opts, traceService),
                (RunOption opts) => Dispatch(commandLineService.RunMigration, opts, traceService),
                (NextVersionOption opts) => Dispatch(commandLineService.IncrementVersion, opts, traceService),
                (ListOption opts) => Dispatch(commandLineService.RunListOption, opts, traceService),
                (VerifyOption opts) => Dispatch(commandLineService.RunVerify, opts, traceService),
                (EraseOption opts) => Dispatch(commandLineService.RunEraseOption, opts, traceService),
                (BaselineOption opts) => Dispatch(commandLineService.RunBaselineOption, opts, traceService),
                (RebaseOption opts) => Dispatch(commandLineService.RunRebaseOption, opts, traceService),
                (ArchiveOption opts) => Dispatch(commandLineService.RunArchiveOption, opts, traceService),
                errs => 1);

            return(resultCode);
        }
示例#2
0
        //https://github.com/commandlineparser/commandline
        //https://github.com/dotnet/command-line-api

        public static int Main(string[] args)
        {
            var directoryService = new DirectoryService();
            var traceService     = new FileTraceService(directoryService);
            var fileService      = new FileService();
            var workspaceService = new WorkspaceService(traceService, directoryService, fileService);

            var environmentService   = new EnvironmentService();
            var configurationService = new ConfigurationService(environmentService, workspaceService, traceService);

            var dataServiceFactory      = new DataServiceFactory(traceService);
            var manifestFactory         = new ManifestFactory(traceService);
            var migrationServiceFactory = new MigrationServiceFactory(traceService);
            var commandLineService      = new CommandLineService(
                migrationServiceFactory,
                dataServiceFactory,
                manifestFactory,
                workspaceService,
                environmentService,
                traceService,
                configurationService);

            var resultCode = Parser.Default
                             .ParseArguments <
                CheckOption,
                InitOption,
                VerifyOption,
                RunOption,
                ApplyOption,
                ListOption,
                NextVersionOption,
                EraseOption,
                DestroyOption,
                PlatformsOption,
                BaselineOption,
                RebaseOption
                //ArchiveOption,
                >(args).MapResult(
                (CheckOption opts) => Dispatch(commandLineService.RunCheckOption, opts, traceService),
                (InitOption opts) => Dispatch(commandLineService.RunInitOption, opts, traceService),
                (VerifyOption opts) => Dispatch(commandLineService.RunVerifyOption, opts, traceService),
                (RunOption opts) => Dispatch(commandLineService.RunRunOption, opts, traceService),
                (ApplyOption opts) => Dispatch(commandLineService.RunApplyOption, opts, traceService),
                (ListOption opts) => Dispatch(commandLineService.RunListOption, opts, traceService),
                (NextVersionOption opts) => Dispatch(commandLineService.RunNextVersionOption, opts, traceService),
                (EraseOption opts) => Dispatch(commandLineService.RunEraseOption, opts, traceService),
                (DestroyOption opts) => Dispatch(commandLineService.RunDestroyOption, opts, traceService),
                (PlatformsOption opts) => Dispatch(commandLineService.RunPlatformsOption, opts, traceService),
                (BaselineOption opts) => Dispatch(commandLineService.RunBaselineOption, opts, traceService),
                (RebaseOption opts) => Dispatch(commandLineService.RunRebaseOption, opts, traceService),
                //(ArchiveOption opts) => Dispatch(commandLineService.RunArchiveOption, opts, traceService)
                errs => 1);

            return(resultCode);
        }
示例#3
0
        //https://github.com/commandlineparser/commandline
        //https://github.com/dotnet/command-line-api

        public static void Main(string[] args)
        {
            var environmentService      = new EnvironmentService();
            var traceService            = new FileTraceService();
            var localVersionService     = new LocalVersionService(traceService);
            var migrationServiceFactory = new CLI.MigrationServiceFactory(traceService);
            var commandLineService      = new CommandLineService(migrationServiceFactory, localVersionService, environmentService, traceService);

            Parser.Default.ParseArguments <
                InitOption,
                RunOption,
                NextVersionOption,
                InfoOption,
                VerifyOption,
                EraseOption,
                BaselineOption,
                RebaseOption>(args)
            .MapResult(
                (InitOption opts) =>
            {
                traceService.IsDebugEnabled = opts.Debug;
                return(commandLineService.RunInitOption(opts));
            },
                (RunOption opts) =>
            {
                traceService.IsDebugEnabled = opts.Debug;
                return(commandLineService.RunMigration(opts));
            },
                (NextVersionOption opts) =>
            {
                traceService.IsDebugEnabled = opts.Debug;
                return(commandLineService.IncrementVersion(opts));
            },
                (InfoOption opts) =>
            {
                traceService.IsDebugEnabled = opts.Debug;
                return(commandLineService.RunInfoOption(opts));
            },
                (VerifyOption opts) =>
            {
                traceService.IsDebugEnabled = opts.Debug;
                return(commandLineService.RunVerify(opts));
            },
                (EraseOption opts) =>
            {
                traceService.IsDebugEnabled = opts.Debug;
                return(commandLineService.RunEraseOption(opts));
            },
                (BaselineOption opts) =>
            {
                traceService.IsDebugEnabled = opts.Debug;
                return(commandLineService.RunBaselineOption(opts));
            },
                (RebaseOption opts) =>
            {
                traceService.IsDebugEnabled = opts.Debug;
                return(commandLineService.RunRebaseOption(opts));
            },
                (ArchiveOption opts) =>
            {
                traceService.IsDebugEnabled = opts.Debug;
                return(commandLineService.RunArchiveOption(opts));
            },
                errs => 1);
        }