From: Mikko Rasa Date: Sun, 18 Dec 2022 18:16:38 +0000 (+0200) Subject: Improve help output for the local package X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=ab1c7f6580c80b7f02ffc8a01199463fc881488b;p=builder.git Improve help output for the local package Only output the required packages list if anything is required, and output an overall header before the package-specific section. --- diff --git a/source/buildercli.cpp b/source/buildercli.cpp index 0a84364..c7a2817 100644 --- a/source/buildercli.cpp +++ b/source/buildercli.cpp @@ -359,16 +359,22 @@ void BuilderCLI::package_help() SourcePackage &main_pkg = dynamic_cast(package_manager.get_main_package()); const Config &config = main_pkg.get_config(); const Config::OptionMap &options = config.get_options(); - - IO::print("\nRequired packages:\n "); const Package::Requirements &requires = main_pkg.get_required_packages(); - for(Package::Requirements::const_iterator i=requires.begin(); i!=requires.end(); ++i) + + if(!requires.empty() || !options.empty()) + IO::print("\nHelp for package %s:\n", main_pkg.get_name()); + + if(!requires.empty()) { - if(i!=requires.begin()) - IO::print(", "); - IO::print((*i)->get_name()); + IO::print("\nRequired packages:\n "); + for(Package::Requirements::const_iterator i=requires.begin(); i!=requires.end(); ++i) + { + if(i!=requires.begin()) + IO::print(", "); + IO::print((*i)->get_name()); + } + IO::print("\n"); } - IO::print("\n"); if(!options.empty()) {