Пример #1
0
        public static async Task <int> Main()
        {
            try
            {
                var commandLineParser = new CommandLineParser <int, int>();
                commandLineParser.AddVerb(new UpdateVerb(), ExecuteUpdateAsync);
                commandLineParser.AddVerb(new AwaitPublishVerb(), ExecuteAwaitPublishAsync);
                commandLineParser.AddVerb(new PruneLocalSourceVerb(), v => Result.Error(ParserError.From(-1)), builder =>
                {
                    builder.AddVerb(new AllVerb(), ExecutePruneAllAsync);
                    //// builder.AddVerb(new NewestPrereleasesPruneModeVerb(), ExecutePruneNewestPrereleasesAsync);
                });
                commandLineParser.AddVerb(new DeleteVerb(), ExecuteDeleteAsync);
                var result = await commandLineParser.ParseAsync(Environment.CommandLine, 1);

                if (!result)
                {
                    result.WriteToConsole();
                }

                return(result.GetExitCode());
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
                return(-1);
            }
        }