Kelsidavis-WoWee/tools/editor/cli_diff_tree.hpp

12 lines
195 B
C++
Raw Normal View History

feat(editor): add --diff-tree to compare two directories of .w* catalogs Walks both trees in parallel, classifies each file by its 4-byte magic, and bucks differences into five categories: - only-in-A file present in A, missing from B (removed) - only-in-B file present in B, missing from A (added) - magic-changed same path but the format swapped (e.g. somebody renamed a .wsrg to .wmat) - size-changed same magic, different byte size (content was edited) - identical same magic, same size Exit 1 if any category but identical is non-zero, so it composes into shell pipelines and CI. JSON sidecar via --json. Useful for project-version comparison: did anything actually change between two snapshots? --diff-tree answers in one pass. Pairs naturally with the existing --diff-headers (which goes deeper on a single file pair) and the --bulk-* / --audit-tree family of cross-tree utilities. Files whose magic isn't recognized by the format table are silently skipped so unrelated junk in the tree (build artifacts, temp files) doesn't pollute the diff. Identity check is magic+size only — true byte-equality would need a hash and the heuristic is good enough for the typical use case. This is the 15th cross-format utility: --list-formats / --info-magic / --summary-dir / --rename-by-magic --bulk-rename-by-magic / --touch-tree / --tree-summary-md --catalog-grep / --diff-headers / --audit-tree / --magic-fix --bulk-validate / --bulk-export-json / --bulk-import-json --diff-tree CLI flag count 988 -> 989.
2026-05-09 22:46:52 -07:00
#pragma once
namespace wowee {
namespace editor {
namespace cli {
bool handleDiffTree(int& i, int argc, char** argv, int& outRc);
} // namespace cli
} // namespace editor
} // namespace wowee