tests fixes

This commit is contained in:
master
2026-01-27 08:23:42 +02:00
parent c305d05d32
commit 82caceba56
58 changed files with 651 additions and 312 deletions

View File

@@ -1189,12 +1189,19 @@ public sealed class VexCliCommandModule : ICliCommandModule
Description = "Friendly name for the webhook"
};
var formatOption = new Option<string>("--format")
{
Description = "Output format (table or json)"
};
formatOption.SetDefaultValue("table");
var addCommand = new Command("add", "Register a new VEX webhook")
{
urlOption,
eventsOption,
secretOption,
nameOption,
formatOption,
verboseOption
};
@@ -1204,10 +1211,26 @@ public sealed class VexCliCommandModule : ICliCommandModule
var events = parseResult.GetValue(eventsOption) ?? [];
var secret = parseResult.GetValue(secretOption);
var name = parseResult.GetValue(nameOption);
var format = parseResult.GetValue(formatOption) ?? "table";
var verbose = parseResult.GetValue(verboseOption);
var newId = $"wh-{Guid.NewGuid().ToString()[..8]}";
if (format.Equals("json", StringComparison.OrdinalIgnoreCase))
{
var result = new
{
id = newId,
url = url,
events = events,
name = name,
status = "Active",
createdAt = DateTimeOffset.UtcNow.ToString("O")
};
Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(result, new System.Text.Json.JsonSerializerOptions { WriteIndented = true }));
return Task.FromResult(0);
}
Console.WriteLine("Webhook registered successfully");
Console.WriteLine();
Console.WriteLine($"ID: {newId}");