tangled
alpha
login
or
join now
angrydutchman.peedee.es
/
plcbundle
forked from
atscan.net/plcbundle
0
fork
atom
A Transparent and Verifiable Way to Sync the AT Protocol's PLC Directory
0
fork
atom
overview
issues
pulls
pipelines
colors in compare
tree.fail
4 months ago
6b34f996
7b907e2a
+20
-4
1 changed file
expand all
collapse all
unified
split
cmd
plcbundle
compare.go
+20
-4
cmd/plcbundle/compare.go
···
190
190
fmt.Printf(" Local bundles: %d\n", c.LocalCount)
191
191
fmt.Printf(" Target bundles: %d\n", c.TargetCount)
192
192
fmt.Printf(" Common bundles: %d\n", c.CommonCount)
193
193
-
fmt.Printf(" Missing bundles: %d\n", len(c.MissingBundles))
194
194
-
fmt.Printf(" Extra bundles: %d\n", len(c.ExtraBundles))
195
195
-
fmt.Printf(" Content mismatches: %d\n", len(c.HashMismatches))
196
196
-
fmt.Printf(" Chain mismatches: %d ⚠️\n", len(c.ChainMismatches))
193
193
+
fmt.Printf(" Missing bundles: %s\n", formatCount(len(c.MissingBundles)))
194
194
+
fmt.Printf(" Extra bundles: %s\n", formatCount(len(c.ExtraBundles)))
195
195
+
fmt.Printf(" Content mismatches: %s\n", formatCount(len(c.HashMismatches)))
196
196
+
fmt.Printf(" Chain mismatches: %s\n", formatCountCritical(len(c.ChainMismatches)))
197
197
198
198
if c.LocalCount > 0 {
199
199
fmt.Printf("\n Local range: %06d - %06d\n", c.LocalRange[0], c.LocalRange[1])
···
330
330
fmt.Printf("This indicates different bundle content or chain integrity issues.\n")
331
331
}
332
332
}
333
333
+
}
334
334
+
335
335
+
// formatCount formats a count with color/symbol
336
336
+
func formatCount(count int) string {
337
337
+
if count == 0 {
338
338
+
return "\033[32m0 ✓\033[0m" // Green with checkmark
339
339
+
}
340
340
+
return fmt.Sprintf("\033[33m%d ⚠️\033[0m", count) // Yellow with warning
341
341
+
}
342
342
+
343
343
+
// formatCountCritical formats a count for critical items (chain mismatches)
344
344
+
func formatCountCritical(count int) string {
345
345
+
if count == 0 {
346
346
+
return "\033[32m0 ✓\033[0m" // Green with checkmark
347
347
+
}
348
348
+
return fmt.Sprintf("\033[31m%d ✗\033[0m", count) // Red with X
333
349
}
334
350
335
351
// filterContentOnlyMismatches returns content mismatches that don't have chain mismatches