Example #1
0
        /// <summary>
        /// get the configuration from the arguments
        /// and launch the command.
        /// </summary>
        /// <param name="argv">Command-line arguments passed to the program.</param>
        private static async Task StartCliAsync(string[] argv)
        {
            var deprecationDisclaimer = new DeprecationDisclaimer(
                new ReleasesHandler(),
                Printer.PrinterFactory.Factory(CLILogs.LogsLevel.Warning, true),
                new EnvironmentVariableReader());
            await deprecationDisclaimer.CheckReleaseDeprecationsAsync();

            var            parser = CreateCommandLineParser();
            IConfiguration configAndcommandValues = parser.Parse(argv);

            PrintInfoDebug.IConfiguration(configAndcommandValues);

            IApiDataManager apiDataManager = CreateApiDataManager();

            if (apiDataManager.Start(configAndcommandValues))
            {
                ICommandManager commandManager = CreateCommandManager(configAndcommandValues.ResultFormat);
                await commandManager.StartAsync(configAndcommandValues);
            }
        }
Example #2
0
        public async Task StartAsync(IConfiguration config, CancellationToken ct = default(CancellationToken))
        {
            try
            {
                await this.StartAsyncThrowError(config, ct);
            }
            catch (AggregateException ae)
            {
                foreach (var ex in ae.InnerExceptions)
                {
                    PrintInfoDebug.DebugException(ex);
                }

                throw new ErrorPrintException();
            }
            catch (Exception ex)
            {
                PrintInfoDebug.DebugException(ex);
                throw new ErrorPrintException();
            }
        }