Make Zeekygen docs generation (-X) imply parse-only (-a)

Nobody generates docs at startup while then moving on to regular Zeek operation,
and the generated runtime output when loading scripts/zeekygen is both noisy and
confusing.
This commit is contained in:
Christian Kreibich 2025-04-02 18:08:30 -07:00
parent e6492f7c7b
commit ec89d6ffff
2 changed files with 6 additions and 2 deletions

View file

@ -133,7 +133,7 @@ void usage(const char* prog) {
printf(" -T|--re-level <level> | set 'RE_level' for rules\n");
printf(" -U|--status-file <file> | Record process status in file\n");
printf(" -W|--watchdog | activate watchdog timer\n");
printf(" -X|--zeekygen <cfgfile> | generate documentation based on config file\n");
printf(" -X|--zeekygen <cfgfile> | generate documentation based on config file; implies -a\n");
#ifdef USE_PERFTOOLS_DEBUG
printf(" -m|--mem-leaks | show leaks [perftools]\n");

View file

@ -641,6 +641,10 @@ SetupResult setup(int argc, char** argv, Options* zopts) {
auto zeekygen_cfg = options.zeekygen_config_file.value_or("");
zeekygen_mgr = new zeekygen::detail::Manager(zeekygen_cfg, zeek_argv[0]);
// Zeekygen documentation generation (via -X) implies we only parse:
if ( ! zeekygen_cfg.empty() )
detail::parse_only = true;
add_essential_input_file("base/init-bare.zeek");
add_essential_input_file("builtin-plugins/__preload__.zeek");
add_essential_input_file("base/init-frameworks-and-bifs.zeek");
@ -985,7 +989,7 @@ SetupResult setup(int argc, char** argv, Options* zopts) {
}
}
if ( options.parse_only ) {
if ( detail::parse_only ) {
if ( analysis_options.usage_issues > 0 )
analyze_scripts(options.no_unused_warnings);