Skip to content

Commit a20245b

Browse files
feat: add archive command summary table to log output
1 parent 26da723 commit a20245b

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/Arius.Cli/CliCommands/ArchiveCliCommand.cs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public async ValueTask ExecuteAsync(IConsole console)
127127
{
128128
var s = result.Value;
129129

130-
RenderArchiveTable(
130+
var table = RenderArchiveTable(
131131
$"{s.TotalLocalFiles}", "?", "?",
132132
"?", "?", "?",
133133
"?", $"+{s.BytesUploadedUncompressed.Bytes().Humanize()}", "?",
@@ -139,11 +139,16 @@ public async ValueTask ExecuteAsync(IConsole console)
139139
"?", $"+ ? - {s.PointerFileEntriesDeleted}", "?"
140140
);
141141

142-
AnsiConsole.MarkupLine("[green]Archive completed successfully![/]");
143-
AnsiConsole.MarkupLine($"[green]Total files scanned: {s.TotalLocalFiles}, {s.UniqueBinariesUploaded} unique uploaded, in {s.UniqueChunksUploaded} chunks[/]");
144-
AnsiConsole.MarkupLine($"[green]Bytes uploaded: {s.BytesUploadedUncompressed.Bytes().Humanize()} -> {s.BytesUploadedCompressed.Bytes().Humanize()} (compression: {(s.BytesUploadedUncompressed > 0 ? ((double)s.BytesUploadedCompressed / s.BytesUploadedUncompressed).ToString("P1") : "N/A")})[/]");
142+
var r = new Recorder(AnsiConsole.Console);
143+
r.Write(table);
144+
145+
r.MarkupLine("[green]Archive completed successfully![/]");
146+
r.MarkupLine($"[green]Total files scanned: {s.TotalLocalFiles}, {s.UniqueBinariesUploaded} unique uploaded, in {s.UniqueChunksUploaded} chunks[/]");
147+
r.MarkupLine($"[green]Bytes uploaded: {s.BytesUploadedUncompressed.Bytes().Humanize()} -> {s.BytesUploadedCompressed.Bytes().Humanize()} (compression: {(s.BytesUploadedUncompressed > 0 ? ((double)s.BytesUploadedCompressed / s.BytesUploadedUncompressed).ToString("P1") : "N/A")})[/]");
145148
if (s.NewStateName is not null)
146-
AnsiConsole.MarkupLine($"[green]State file uploaded: {s.NewStateName}[/]");
149+
r.MarkupLine($"[green]State file uploaded: {s.NewStateName}[/]");
150+
151+
logger.LogInformation(r.ExportText());
147152
}
148153
else
149154
{
@@ -171,7 +176,7 @@ public async ValueTask ExecuteAsync(IConsole console)
171176
//}
172177
}
173178

174-
private void RenderArchiveTable(
179+
private Table RenderArchiveTable(
175180
// Local (Before, Operation, After) × 4 rows
176181
string localFilesBefore, string localFilesOp, string localFilesAfter,
177182
string localBinariesBefore, string localBinariesOp, string localBinariesAfter,
@@ -226,7 +231,7 @@ Table MakeSubTable(string title)
226231
table.AddColumn(new TableColumn(local).Centered());
227232
table.AddColumn(new TableColumn(remote).Centered());
228233

229-
AnsiConsole.Write(table);
234+
return table;
230235
}
231236
}
232237

0 commit comments

Comments
 (0)