Git commit abe4cf121e3691008de810105bb6f1e7901945b6 by Andrew Shark.
Committed on 05/02/2024 at 15:28.
Pushed by ashark into branch 'master'.

query: Add module-set query mode

This can be used for example for querying all defined modules and module-sets, 
for preparing zsh autocompletion cache

M  +3    -0    doc/man-kdesrc-build.1.docbook
M  +4    -0    doc/supported-cmdline-params.docbook
M  +2    -0    modules/ksb/Application.pm

https://invent.kde.org/sdk/kdesrc-build/-/commit/abe4cf121e3691008de810105bb6f1e7901945b6

diff --git a/doc/man-kdesrc-build.1.docbook b/doc/man-kdesrc-build.1.docbook
index 6402063b..6556b358 100644
--- a/doc/man-kdesrc-build.1.docbook
+++ b/doc/man-kdesrc-build.1.docbook
@@ -686,6 +686,9 @@ one of the following:</para>
         <option>branch</option> and <option>branch-group</option> settings in
         effect.
         </para></listitem>
+    <listitem><para><option>module-set</option>, which causes &kdesrc-build; to
+        output the name of module-set which contains the module. This can be 
used
+        to generate zsh autocompletion cache.</para></listitem>
     <listitem><para>Otherwise, option names that are valid for modules in the
         configuration file can be used, the resolved value of which will be
         listed for each module.
diff --git a/doc/supported-cmdline-params.docbook 
b/doc/supported-cmdline-params.docbook
index 4cb6e494..b52bf204 100644
--- a/doc/supported-cmdline-params.docbook
+++ b/doc/supported-cmdline-params.docbook
@@ -302,6 +302,10 @@ one of the following:</para>
         linkend="conf-branch">branch</link> and <link
         linkend="conf-branch-group">branch-group</link> settings in effect.
         </para></listitem>
+    <listitem><para><parameter>module-set</parameter>, which causes 
&kdesrc-build; to
+        output the name of module-set which contains the module. This can be 
used
+        to generate zsh autocompletion cache.
+        </para></listitem>
     <listitem><para>Any option name that is valid for modules in the
         <link linkend="conf-options-table">configuration file</link>.
         </para></listitem>
diff --git a/modules/ksb/Application.pm b/modules/ksb/Application.pm
index c4cf0a59..320ce3e8 100644
--- a/modules/ksb/Application.pm
+++ b/modules/ksb/Application.pm
@@ -647,6 +647,8 @@ sub runAllModulePhases
             $query = sub { $_[0]->fullProjectPath() }
         } elsif ($queryMode eq "branch") {
             $query = sub 
{($_[0]->scm()->_determinePreferredCheckoutSource())[0] // ""}
+        } elsif ($queryMode eq "module-set") {
+            $query = sub { $_[0]->{"module-set"}->{"name"} // 
"undefined_module-set"}
         } else {  # Default to ->getOption as query method.
             $query = sub { $_[0]->getOption($queryMode) }
         }

Reply via email to