mirror of
https://github.com/EpicMorg/atlassian-downloader.git
synced 2024-12-28 13:05:29 +03:00
1.0.0.7
* show versions from feed
This commit is contained in:
parent
5428e862ca
commit
1f7bf6b9ab
@ -24,11 +24,13 @@ namespace EpicMorg.Atlassian.Downloader {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="outputDir">Override output directory to download</param>
|
/// <param name="OutputDir">Override output directory to download.</param>
|
||||||
/// <param name="list">Show all download links from feed without downloading</param>
|
/// <param name="ListURL">Show all download links from feed(s) without downloading.</param>
|
||||||
|
/// <param name="ListVersions">Show all versions from feed(s) without downloading.</param>
|
||||||
|
/// <param name="ShowRawJson">Show raw json content from feed(s) downloading.</param>
|
||||||
/// <param name="customFeed">Override URIs to import.</param>
|
/// <param name="customFeed">Override URIs to import.</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
static async Task Main(string outputDir = "atlassian", bool list = false, Uri[] customFeed = null) => await
|
static async Task Main(string OutputDir = "atlassian", bool ListURL = false, bool ListVersions = false, Uri[] customFeed = null, bool ShowRawJson = false) => await
|
||||||
Host
|
Host
|
||||||
.CreateDefaultBuilder()
|
.CreateDefaultBuilder()
|
||||||
.ConfigureHostConfiguration(configHost => configHost.AddEnvironmentVariables())
|
.ConfigureHostConfiguration(configHost => configHost.AddEnvironmentVariables())
|
||||||
@ -51,11 +53,11 @@ namespace EpicMorg.Atlassian.Downloader {
|
|||||||
builder.AddSerilog(dispose: true);
|
builder.AddSerilog(dispose: true);
|
||||||
});
|
});
|
||||||
services.AddHostedService<Program>();
|
services.AddHostedService<Program>();
|
||||||
services.AddSingleton(new Arguments(outputDir, list, customFeed));
|
services.AddSingleton(new Arguments(OutputDir, ListURL, ListVersions, customFeed, ShowRawJson));
|
||||||
})
|
})
|
||||||
.RunConsoleAsync();
|
.RunConsoleAsync();
|
||||||
|
|
||||||
public record Arguments(string outputDir = "atlassian", bool list = false, Uri[] customFeed = null);
|
public record Arguments(string OutputDir = "atlassian", bool ListURL = false, bool ListVersions = false, Uri[] CustomFeed = null, bool ShowRawJson = false);
|
||||||
|
|
||||||
public async Task StartAsync(CancellationToken cancellationToken) {
|
public async Task StartAsync(CancellationToken cancellationToken) {
|
||||||
|
|
||||||
@ -67,8 +69,8 @@ namespace EpicMorg.Atlassian.Downloader {
|
|||||||
appBuildType = "[Debug]";
|
appBuildType = "[Debug]";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
var feedUrls = arguments.customFeed != null
|
var feedUrls = arguments.CustomFeed != null
|
||||||
? arguments.customFeed.Select(a => a.ToString()).ToArray()
|
? arguments.CustomFeed.Select(a => a.ToString()).ToArray()
|
||||||
: new[] {
|
: new[] {
|
||||||
"https://my.atlassian.com/download/feeds/archived/bamboo.json",
|
"https://my.atlassian.com/download/feeds/archived/bamboo.json",
|
||||||
"https://my.atlassian.com/download/feeds/archived/clover.json",
|
"https://my.atlassian.com/download/feeds/archived/clover.json",
|
||||||
@ -106,7 +108,7 @@ namespace EpicMorg.Atlassian.Downloader {
|
|||||||
var client = new HttpClient();
|
var client = new HttpClient();
|
||||||
|
|
||||||
foreach (var feedUrl in feedUrls) {
|
foreach (var feedUrl in feedUrls) {
|
||||||
var feedDir = Path.Combine(arguments.outputDir, feedUrl[(feedUrl.LastIndexOf('/') + 1)..(feedUrl.LastIndexOf('.'))]);
|
var feedDir = Path.Combine(arguments.OutputDir, feedUrl[(feedUrl.LastIndexOf('/') + 1)..(feedUrl.LastIndexOf('.'))]);
|
||||||
var atlassianJson = await client.GetStringAsync(feedUrl);
|
var atlassianJson = await client.GetStringAsync(feedUrl);
|
||||||
var callString = "downloads(";
|
var callString = "downloads(";
|
||||||
var json = atlassianJson[callString.Length..^1];
|
var json = atlassianJson[callString.Length..^1];
|
||||||
@ -114,7 +116,28 @@ namespace EpicMorg.Atlassian.Downloader {
|
|||||||
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
|
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
|
||||||
});
|
});
|
||||||
var versionsProg = parsed.GroupBy(a => a.Version).ToDictionary(a => a.Key, a => a.ToArray());
|
var versionsProg = parsed.GroupBy(a => a.Version).ToDictionary(a => a.Key, a => a.ToArray());
|
||||||
if (arguments.list) {
|
if (arguments.ShowRawJson)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Not released yet.");
|
||||||
|
return;
|
||||||
|
//foreach (var versionProg in versionsProg)
|
||||||
|
//{
|
||||||
|
// foreach (var file in versionProg.Value)
|
||||||
|
// {
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
else if (arguments.ListVersions)
|
||||||
|
{
|
||||||
|
foreach (var versionProg in versionsProg)
|
||||||
|
{
|
||||||
|
foreach (var file in versionProg.Value)
|
||||||
|
{
|
||||||
|
Console.WriteLine(file.Version);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (arguments.ListURL) {
|
||||||
foreach (var versionProg in versionsProg) {
|
foreach (var versionProg in versionsProg) {
|
||||||
foreach (var file in versionProg.Value) {
|
foreach (var file in versionProg.Value) {
|
||||||
Console.WriteLine(file.ZipUrl);
|
Console.WriteLine(file.ZipUrl);
|
||||||
@ -153,7 +176,6 @@ namespace EpicMorg.Atlassian.Downloader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
logger.LogTrace($"Download complete at {appStartupDate}.");
|
logger.LogTrace($"Download complete at {appStartupDate}.");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,15 +11,15 @@
|
|||||||
<ApplicationIcon>favicon.ico</ApplicationIcon>
|
<ApplicationIcon>favicon.ico</ApplicationIcon>
|
||||||
<PackageId>EpicMorg.Atlassian.Downloader</PackageId>
|
<PackageId>EpicMorg.Atlassian.Downloader</PackageId>
|
||||||
<Authors>Atlassian Downloader</Authors>
|
<Authors>Atlassian Downloader</Authors>
|
||||||
<Description>Atlassian Downloader by EpicMorg, code by kasthack</Description>
|
<Description>Atlassian Downloader by EpicMorg</Description>
|
||||||
<PackageProjectUrl>https://github.com/EpicMorg/atlassian-downloader</PackageProjectUrl>
|
<PackageProjectUrl>https://github.com/EpicMorg/atlassian-downloader</PackageProjectUrl>
|
||||||
<PackageIcon>favicon.png</PackageIcon>
|
<PackageIcon>favicon.png</PackageIcon>
|
||||||
<RepositoryType>git</RepositoryType>
|
<RepositoryType>git</RepositoryType>
|
||||||
<RepositoryUrl>https://github.com/EpicMorg/atlassian-downloader</RepositoryUrl>
|
<RepositoryUrl>https://github.com/EpicMorg/atlassian-downloader</RepositoryUrl>
|
||||||
<PackageTags>atlassian, donwloader, epicmorg</PackageTags>
|
<PackageTags>atlassian, donwloader, epicmorg</PackageTags>
|
||||||
<AssemblyVersion>1.0.0.6</AssemblyVersion>
|
<AssemblyVersion>1.0.0.7</AssemblyVersion>
|
||||||
<FileVersion>1.0.0.6</FileVersion>
|
<FileVersion>1.0.0.7</FileVersion>
|
||||||
<Version>1.0.0.6</Version>
|
<Version>1.0.0.7</Version>
|
||||||
<Copyright>EpicMorg 2021</Copyright>
|
<Copyright>EpicMorg 2021</Copyright>
|
||||||
<Product>Atlassian Downloader</Product>
|
<Product>Atlassian Downloader</Product>
|
||||||
<IsPackable>true</IsPackable>
|
<IsPackable>true</IsPackable>
|
||||||
|
Loading…
Reference in New Issue
Block a user