2024-08-26 20:00:13 +02:00
|
|
|
using System.CommandLine;
|
|
|
|
|
using System.CommandLine.NamingConventionBinder;
|
|
|
|
|
|
|
|
|
|
namespace Duplicati.CommandLine.ServerUtil.Commands;
|
|
|
|
|
|
|
|
|
|
public static class ListBackups
|
|
|
|
|
{
|
|
|
|
|
public static Command Create() =>
|
|
|
|
|
new Command("list-backups", "List all backups")
|
|
|
|
|
.WithHandler(CommandHandler.Create<Settings>(async (settings) =>
|
|
|
|
|
{
|
|
|
|
|
var bks = await (await settings.GetConnection()).ListBackups();
|
|
|
|
|
|
|
|
|
|
if (!bks.Any())
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("No backups found");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (var bk in bks)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine($"{bk.ID}: {bk.Name}");
|
2024-09-03 22:02:51 +02:00
|
|
|
if (!string.IsNullOrEmpty(bk.Description))
|
|
|
|
|
Console.WriteLine($" {bk.Description}");
|
2024-08-26 20:00:13 +02:00
|
|
|
Console.WriteLine();
|
|
|
|
|
}
|
|
|
|
|
}));
|
|
|
|
|
}
|