From: Mikko Rasa Date: Thu, 5 Oct 2023 09:39:33 +0000 (+0300) Subject: Show configuration of all packages with --help --conf-all X-Git-Url: https://git.tdb.fi/?a=commitdiff_plain;h=d59b8671cee1b2dd08b93c58c199781965c201fe;p=builder.git Show configuration of all packages with --help --conf-all Also other tweaks to help output. --- diff --git a/source/cli/buildercli.cpp b/source/cli/buildercli.cpp index cfd367c..efb2589 100644 --- a/source/cli/buildercli.cpp +++ b/source/cli/buildercli.cpp @@ -339,12 +339,11 @@ void BuilderCLI::package_help() return; SourcePackage &main_pkg = dynamic_cast(package_manager.get_main_package()); - const Config &config = main_pkg.get_config(); - const auto &options = config.get_options(); - const Package::Requirements &required_pkgs = main_pkg.get_required_packages(); + Package::Requirements required_pkgs; + main_pkg.collect_required_packages(required_pkgs); - if(!required_pkgs.empty() || !options.empty()) - IO::print("\nHelp for package %s:\n", main_pkg.get_name()); + IO::print("\nMain package: %s\n", main_pkg.get_name()); + IO::print("Source directory: %s\n", main_pkg.get_source_directory()); if(!required_pkgs.empty()) { @@ -358,9 +357,24 @@ void BuilderCLI::package_help() IO::print("\n"); } + if(conf_all) + { + for(const Package *pkg: required_pkgs) + if(const SourcePackage *spkg = dynamic_cast(pkg)) + config_help(*spkg); + } + else + config_help(main_pkg); +} + +void BuilderCLI::config_help(const SourcePackage &pkg) +{ + const Config &config = pkg.get_config(); + const auto &options = config.get_options(); + if(!options.empty()) { - IO::print("\nPackage configuration:\n"); + IO::print("\nConfiguration for package %s:\n", pkg.get_name()); for(const auto &kvp: options) { const Config::Option &opt = kvp.second; diff --git a/source/cli/buildercli.h b/source/cli/buildercli.h index f4b2ad7..fcd65ae 100644 --- a/source/cli/buildercli.h +++ b/source/cli/buildercli.h @@ -44,6 +44,7 @@ private: Target *resolve_target(const std::string &); void package_help(); + void config_help(const SourcePackage &); }; #endif