Kelsidavis-WoWee/tools/editor/cli_list_by_magic.hpp
Kelsi 6abd3f5398 feat(editor): add --list-by-magic to filter a tree to one specific format
Walks a directory recursively and lists every file matching a
4-character magic. Reports per-file size, entry count, catalog
name, and relative path; aggregates total bytes + total entries
across the matches.

Useful for narrow per-format inventory: "show me all the WSPL
spell catalogs in my project" or "find every WCDF that defines
raid difficulty variants under my custom-content tree". The
existing --summary-dir gives a multi-format rollup; this is the
single-format zoom-in.

Magic argument is case-insensitive — "WSPL" and "wspl" both
match. If the magic is recognized in the format table the report
header includes the format description and category; if not (e.g.
a server-custom magic), the listing still works and just notes
"unknown magic — no metadata". JSON sidecar via --json. Exit 1
if no matches (so it composes into shell "if any matches, do X"
pipelines).

This is the 17th 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 / --orphan-jsons / --list-by-magic

CLI flag count 1032 -> 1033.
2026-05-09 23:18:46 -07:00

11 lines
198 B
C++

#pragma once
namespace wowee {
namespace editor {
namespace cli {
bool handleListByMagic(int& i, int argc, char** argv, int& outRc);
} // namespace cli
} // namespace editor
} // namespace wowee