示例#1
0
        private static async Task RunApplication(string[] args)
        {
            var toolArguments = new ToolArguments();

            var cmdLineParser = new CommandLineParser.CommandLineParser
            {
                ShowUsageHeader = "Here is how you use the repository provisioning app:",
                ShowUsageFooter = "For more information, see https://github.com/arcus-azure/arcus"
            };

            try
            {
                cmdLineParser.ExtractArgumentAttributes(toolArguments);
                cmdLineParser.ParseCommandLine(args);

                await ConfigureRepositoryDefaults(toolArguments);
            }
            catch (MandatoryArgumentNotSetException)
            {
                Console.ForegroundColor = AnnouncementColor;
                Console.WriteLine(value: "Failed to interpret your request. Here are the parsed commands.");
                cmdLineParser.ShowParsedArguments();

                Console.WriteLine(value: "Please make sure that you call the commands correctly.\r\n");
                ShowUsage(cmdLineParser);
            }
        }
示例#2
0
 private static async Task ConfigureRepositoryDefaults(ToolArguments arguments)
 {
     var repositoryConfiguration = ConfigurationProvider.Get(arguments.ConfigurationFilePath);
     var repositoryConfigurator  = new DefaultRepositoryConfigurator(arguments.UserName, arguments.Password, arguments.Repository);
     await repositoryConfigurator.Configure(repositoryConfiguration);
 }