mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-10 02:53:51 +00:00
refactor(editor): extract CLI introspection handlers into cli_introspect.cpp
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.
This commit is contained in:
parent
96bb1f6d04
commit
e117e5aaff
4 changed files with 365 additions and 281 deletions
23
tools/editor/cli_introspect.hpp
Normal file
23
tools/editor/cli_introspect.hpp
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#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
|
||||
Loading…
Add table
Add a link
Reference in a new issue