Add detailed comparison assertions

This commit is contained in:
2026-11-07 04:49:40 +00:00
parent 65b454b2ab
commit 1986c44f49
6 changed files with 184 additions and 2 deletions

View File

@@ -18,6 +18,8 @@ type configCommandInput[I, S any] struct {
under commandkit.Supplied[string]
explicit commandkit.Supplied[bool]
sourceID commandkit.Supplied[string]
details commandkit.Supplied[bool]
check commandkit.Supplied[bool]
values commandkit.FlagValues[I]
againstValues commandkit.FlagValues[I]
plan *configOperationPlan[I, S]
@@ -41,6 +43,8 @@ type configOperationPlan[I, S any] struct {
path configkit.Path
pathSet bool
sourceID commandkit.Supplied[string]
details bool
check bool
list bool
help bool
historical bool
@@ -78,6 +82,8 @@ func newConfigOperationCommand[I, S any](prepared *preparedSuite[I, S], operatio
}
if operation == Diff {
flags = append(flags,
commandkit.BoolFlag(commandkit.FlagMeta{Name: "details", Usage: "Show native before and after difference evidence."}, false, func(input **configCommandInput[I, S], value commandkit.Supplied[bool]) { (*input).details = value }),
commandkit.BoolFlag(commandkit.FlagMeta{Name: "check", Usage: "Return status 3 when differences are found."}, false, func(input **configCommandInput[I, S], value commandkit.Supplied[bool]) { (*input).check = value }),
commandkit.ValueFlag(commandkit.FlagMeta{Name: "against-config", Usage: "Configuration source for the right side.", Completion: commandkit.CompleteFiles()}, (*string)(nil), parseConfigString,
func(input **configCommandInput[I, S], value commandkit.Supplied[string]) {
(*input).against.Config = value
@@ -248,6 +254,8 @@ func prepareConfigOperation[I, S any](prepared *preparedSuite[I, S], operation O
path: path,
pathSet: input.path.Set,
sourceID: input.sourceID,
details: input.details.Value,
check: input.check.Value,
list: input.list.Value,
historical: input.historical.Value,
under: under,