(result deduplicateResult, quiet bool)
| 419 | } |
| 420 | |
| 421 | func outputDeduplicateResult(result deduplicateResult, quiet bool) error { |
| 422 | if dedupFormat == "json" { |
| 423 | return WriteJSON(os.Stdout, result) |
| 424 | } |
| 425 | |
| 426 | if result.Duplicates == 0 { |
| 427 | if !quiet { |
| 428 | fmt.Println("No duplicate IDs found.") |
| 429 | } |
| 430 | return nil |
| 431 | } |
| 432 | |
| 433 | prefix := "" |
| 434 | if result.DryRun { |
| 435 | prefix = "[dry-run] " |
| 436 | } |
| 437 | |
| 438 | fmt.Printf("%sFound %d duplicate(s) to resolve:\n\n", prefix, result.Duplicates) |
| 439 | for _, r := range result.Reassignments { |
| 440 | fmt.Printf(" %s → %s %s\n", r.OldID, r.NewID, r.Title) |
| 441 | fmt.Printf(" %s → %s\n", r.OldFilePath, r.NewFilePath) |
| 442 | } |
| 443 | |
| 444 | if result.DryRun && len(result.AmbiguousRefs) > 0 { |
| 445 | fmt.Println("\n[dry-run] Ambiguous references detected:") |
| 446 | for _, ref := range result.AmbiguousRefs { |
| 447 | fmt.Printf(" %s references %q in %s (%d candidates)\n", |
| 448 | ref.ReferencingFile, ref.DuplicateID, ref.Field, len(ref.Candidates)) |
| 449 | } |
| 450 | } |
| 451 | |
| 452 | if result.DryRun { |
| 453 | fmt.Println("\nNo changes made (dry-run mode).") |
| 454 | } else { |
| 455 | fmt.Printf("\nResolved %d duplicate(s).\n", result.Duplicates) |
| 456 | } |
| 457 | |
| 458 | return nil |
| 459 | } |
no test coverage detected