Пример #1
0
        private static string[] GetNugetSources(ConsoleParameters parameters, LaunchpadConfig config)
        {
            const string sourceParameter = "--source";

            if (!parameters.HasParameterWithValue(sourceParameter))
            {
                return(config.NugetSources);
            }

            return(parameters.GetValues(sourceParameter).ToArray());
        }
Пример #2
0
        private static string GetPackageNameOrNull(string templateName, LaunchpadConfig config)
        {
            var templateDefinition = config.Definitions.FirstOrDefault(d => d.Name == templateName);

            if (templateDefinition != null)
            {
                return(templateDefinition.PackageName);
            }

            const string nugetPrefix = "nuget::";

            if (templateName.StartsWith(nugetPrefix))
            {
                return(templateName.Remove(0, nugetPrefix.Length));
            }

            Console.Out.WriteLine($"There's no template named '{templateName}'. Use 'list' command to view available ones. Also you can specify nuget package directly like this: 'nuget::Vostok.Launchpad.Templates.Library'.");
            return(null);
        }