feat(management): additive Skip/Take paging on template/instance lists (arch-review P2)

Claude-Session: https://claude.ai/code/session_01MtdgwpEeCUn6cUA5f1LMPj
This commit is contained in:
Joseph Doherty
2026-07-10 05:57:14 -04:00
parent 8221ee797e
commit 655834f0b8
10 changed files with 152 additions and 13 deletions
@@ -59,13 +59,19 @@ public static class TemplateCommands
Description = "Include full template definitions (all attributes/alarms/scripts) in table output. "
+ "Without it, table output is a compact summary (counts only). JSON output is always full."
};
var skipOption = new Option<int>("--skip") { Description = "Offset paging: number of items to skip (default 0)" };
var takeOption = new Option<int?>("--take") { Description = "Offset paging: max items to return (1..1000; omit for unlimited)" };
var cmd = new Command("list") { Description = "List all templates (compact table summary; use --detail for the full dump)" };
cmd.Add(detailOption);
cmd.Add(skipOption);
cmd.Add(takeOption);
cmd.SetAction(async (ParseResult result) =>
{
var detail = result.GetValue(detailOption);
var skip = result.GetValue(skipOption);
var take = result.GetValue(takeOption);
return await CommandHelpers.ExecuteCommandAsync(
result, urlOption, formatOption, usernameOption, passwordOption, new ListTemplatesCommand(),
result, urlOption, formatOption, usernameOption, passwordOption, new ListTemplatesCommand(skip, take),
tableProjector: detail ? null : TemplateTableProjection.ProjectSummary);
});
return cmd;