mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-04-23 06:24:48 +00:00
[CLI] Don't show 'completed' when export failed
This commit is contained in:
@@ -7,6 +7,8 @@ namespace DiscordChatExporter.Cli.Internal
|
|||||||
private readonly int _posX;
|
private readonly int _posX;
|
||||||
private readonly int _posY;
|
private readonly int _posY;
|
||||||
|
|
||||||
|
private bool _isCompleted;
|
||||||
|
|
||||||
public InlineProgress()
|
public InlineProgress()
|
||||||
{
|
{
|
||||||
// If output is not redirected - save initial cursor position
|
// If output is not redirected - save initial cursor position
|
||||||
@@ -27,6 +29,8 @@ namespace DiscordChatExporter.Cli.Internal
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ReportCompletion() => _isCompleted = true;
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
// If output is not redirected - reset cursor position
|
// If output is not redirected - reset cursor position
|
||||||
@@ -34,7 +38,10 @@ namespace DiscordChatExporter.Cli.Internal
|
|||||||
Console.SetCursorPosition(_posX, _posY);
|
Console.SetCursorPosition(_posX, _posY);
|
||||||
|
|
||||||
// Inform about completion
|
// Inform about completion
|
||||||
Console.WriteLine("Completed ✓");
|
if (_isCompleted)
|
||||||
|
Console.WriteLine("Completed ✓");
|
||||||
|
else
|
||||||
|
Console.WriteLine("Failed X");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -49,6 +49,9 @@ namespace DiscordChatExporter.Cli.Verbs
|
|||||||
|
|
||||||
// Export
|
// Export
|
||||||
await exportService.ExportChatLogAsync(chatLog, filePath, Options.ExportFormat, Options.PartitionLimit);
|
await exportService.ExportChatLogAsync(chatLog, filePath, Options.ExportFormat, Options.PartitionLimit);
|
||||||
|
|
||||||
|
// Report successful completion
|
||||||
|
progress.ReportCompletion();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,6 +59,9 @@ namespace DiscordChatExporter.Cli.Verbs
|
|||||||
// Export
|
// Export
|
||||||
await exportService.ExportChatLogAsync(chatLog, filePath, Options.ExportFormat,
|
await exportService.ExportChatLogAsync(chatLog, filePath, Options.ExportFormat,
|
||||||
Options.PartitionLimit);
|
Options.PartitionLimit);
|
||||||
|
|
||||||
|
// Report successful completion
|
||||||
|
progress.ReportCompletion();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (HttpErrorStatusCodeException ex) when (ex.StatusCode == HttpStatusCode.Forbidden)
|
catch (HttpErrorStatusCodeException ex) when (ex.StatusCode == HttpStatusCode.Forbidden)
|
||||||
|
|||||||
@@ -60,6 +60,9 @@ namespace DiscordChatExporter.Cli.Verbs
|
|||||||
// Export
|
// Export
|
||||||
await exportService.ExportChatLogAsync(chatLog, filePath, Options.ExportFormat,
|
await exportService.ExportChatLogAsync(chatLog, filePath, Options.ExportFormat,
|
||||||
Options.PartitionLimit);
|
Options.PartitionLimit);
|
||||||
|
|
||||||
|
// Report successful completion
|
||||||
|
progress.ReportCompletion();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (HttpErrorStatusCodeException ex) when (ex.StatusCode == HttpStatusCode.Forbidden)
|
catch (HttpErrorStatusCodeException ex) when (ex.StatusCode == HttpStatusCode.Forbidden)
|
||||||
|
|||||||
Reference in New Issue
Block a user