]> git.tdb.fi Git - builder.git/commitdiff
Improve help output for the local package
authorMikko Rasa <tdb@tdb.fi>
Sun, 18 Dec 2022 18:16:38 +0000 (20:16 +0200)
committerMikko Rasa <tdb@tdb.fi>
Mon, 19 Dec 2022 00:06:49 +0000 (02:06 +0200)
Only output the required packages list if anything is required, and
output an overall header before the package-specific section.

source/buildercli.cpp

index 0a84364c988e69bee2925f405573fcff63e66d74..c7a2817ce4d6315ea99f33c3e414049c49f8b083 100644 (file)
@@ -359,16 +359,22 @@ void BuilderCLI::package_help()
        SourcePackage &main_pkg = dynamic_cast<SourcePackage &>(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())
        {