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> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="System.CommandLine.DragonFruit" Version="0.3.0-alpha.21216.1" /> <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="json">Atlassian product JSON</param>
/// <param name="product">Product name</param> /// <param name="product">Product name</param>
/// <param name="force">Overwrite existing directories</param> /// <param name="force">Overwrite existing directories</param>
/// <param name="archiveType">Overwrite archive type</param>
/// <param name="ignoreVersionsWithoutTemplates">Silently ignore versions without templates</param> /// <param name="ignoreVersionsWithoutTemplates">Silently ignore versions without templates</param>
/// <returns></returns> /// <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 jsonData = File.ReadAllText(json.FullName)["downloads(".Length..^1];
var items = JsonSerializer.Deserialize<ResponseItem[]>(jsonData, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); 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 majorVersion = item.Version.Split(".").First();
var templatePath = Path.Combine(workdir.FullName, product, "templates", majorVersion); var templatePath = Path.Combine(workdir.FullName, product, "templates", majorVersion);