mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-10 19:13:52 +00:00
Moves five self-discovery handlers (--list-commands,
--info-cli-stats, --info-cli-categories, --info-cli-help,
--gen-completion) out of main.cpp into a new
cli_introspect.{hpp,cpp} module. All five auto-discover
commands by parsing printUsage's stdout via tmpfile capture,
so the surface stays self-describing as new flags are added.
Useful for shell completion scripts that re-exec the binary
at completion time, IDE plugins, and 'is there a flag for X?'
search workflows. main.cpp shrinks by 276 lines (2,298 to
2,022). --validate-cli-help stays inline because it needs
direct access to the static-local kArgRequired array.
23 lines
856 B
C++
23 lines
856 B
C++
#pragma once
|
|
|
|
namespace wowee {
|
|
namespace editor {
|
|
namespace cli {
|
|
|
|
// Dispatch the CLI introspection / discoverability handlers —
|
|
// auto-discover commands by parsing printUsage's output so the
|
|
// surface stays self-describing as new flags are added. Useful
|
|
// for shell completion, IDE plugins, and 'is there a flag for X?'
|
|
// search workflows.
|
|
// --list-commands flat sorted/deduped flag list
|
|
// --info-cli-stats per-category counts (--info-* / --validate-*)
|
|
// --info-cli-categories per-category command listing
|
|
// --info-cli-help <q> substring search through help text
|
|
// --gen-completion <bash|zsh> re-exec'd at completion time
|
|
//
|
|
// Returns true if matched; outRc holds the exit code.
|
|
bool handleIntrospect(int& i, int argc, char** argv, int& outRc);
|
|
|
|
} // namespace cli
|
|
} // namespace editor
|
|
} // namespace wowee
|