edit generator

This commit is contained in:
stam 2021-05-19 02:59:58 +03:00
parent 8d59cbc056
commit fd524c76a8
2 changed files with 4 additions and 3 deletions

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.CommandLine.DragonFruit" Version="0.3.0-alpha.21216.1" />

View File

@ -16,13 +16,14 @@
/// <param name="json">Atlassian product JSON</param>
/// <param name="product">Product name</param>
/// <param name="force">Overwrite existing directories</param>
/// <param name="archiveType">Overwrite archive type</param>
/// <param name="ignoreVersionsWithoutTemplates">Silently ignore versions without templates</param>
/// <returns></returns>
public static async Task Main(DirectoryInfo workdir, FileInfo json, string product, bool force = false, bool ignoreVersionsWithoutTemplates = false)
public static async Task Main(DirectoryInfo workdir, FileInfo json, string product, bool force = false, bool ignoreVersionsWithoutTemplates = false,string archiveType = ".tar.gz")
{
var jsonData = File.ReadAllText(json.FullName)["downloads(".Length..^1];
var items = JsonSerializer.Deserialize<ResponseItem[]>(jsonData, new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
foreach (var item in items.Where(a=>a.ZipUrl.ToString().EndsWith(".tar.gz")))
foreach (var item in items.Where(a=>a.ZipUrl.ToString().EndsWith(archiveType)))
{
var majorVersion = item.Version.Split(".").First();
var templatePath = Path.Combine(workdir.FullName, product, "templates", majorVersion);