[sdk/kdesrc-build] /: query: Make behavior the same when one module is queried

Andrew Shark null at kde.org
Mon Feb 5 17:26:08 GMT 2024


Git commit 49ec03c7dca5a0cabaeb54fb34a9100dd6c2b2e4 by Andrew Shark.
Committed on 05/02/2024 at 14:20.
Pushed by ashark into branch 'master'.

query: Make behavior the same when one module is queried

M  +0    -7    doc/man-kdesrc-build.1.docbook
M  +0    -7    doc/supported-cmdline-params.docbook
M  +3    -9    modules/ksb/Application.pm
M  +0    -5    modules/ksb/Cmdline.pm

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

diff --git a/doc/man-kdesrc-build.1.docbook b/doc/man-kdesrc-build.1.docbook
index 59279ee1..6402063b 100644
--- a/doc/man-kdesrc-build.1.docbook
+++ b/doc/man-kdesrc-build.1.docbook
@@ -692,13 +692,6 @@ one of the following:</para>
         </para></listitem>
     </itemizedlist>
 
-<para>
-If a single module is passed on the command line, then the output is simply the
-value of the parameter being queried. If multiple (or no) modules are passed on
-the command line, then each line is prefixed by the name of the module. Either
-way, <command>kdesrc-build</command> stops running once each value is output.
-</para>
-
 <para>This option was added with <command>kdesrc-build</command> 16.05.</para>
 
 <informalexample>
diff --git a/doc/supported-cmdline-params.docbook b/doc/supported-cmdline-params.docbook
index 7c4f8f31..4cb6e494 100644
--- a/doc/supported-cmdline-params.docbook
+++ b/doc/supported-cmdline-params.docbook
@@ -307,13 +307,6 @@ one of the following:</para>
         </para></listitem>
     </itemizedlist>
 
-<para>
-If a single module is passed on the command line, then the output is simply the
-value of the parameter being queried. If multiple (or no) modules are passed on
-the command line, then each line is prefixed by the name of the module. Either way,
-&kdesrc-build; stops running once each value is output.
-</para>
-
 <informalexample>
 <para>For example, the command <userinput><command>kdesrc-build</command>
 <option>--query</option> <option>branch</option> <replaceable>kactivities</replaceable> <replaceable>kdepim</replaceable></userinput>
diff --git a/modules/ksb/Application.pm b/modules/ksb/Application.pm
index 3aaa41e7..bebc229e 100644
--- a/modules/ksb/Application.pm
+++ b/modules/ksb/Application.pm
@@ -642,16 +642,10 @@ sub runAllModulePhases
         $query = sub { $_[0]->fullpath('build') }  if $queryMode eq 'build-dir';
         $query = sub { $_[0]->installationPath() } if $queryMode eq 'install-dir';
         $query = sub { $_[0]->fullProjectPath() }  if $queryMode eq 'project-path';
-        $query = sub { ($_[0]->scm()->_determinePreferredCheckoutSource())[0] // '' }
-            if $queryMode eq 'branch';
+        $query = sub { ($_[0]->scm()->_determinePreferredCheckoutSource())[0] // '' } if $queryMode eq 'branch';
 
-        if (@modules == 1) {
-            # No leading module name, just the value
-            say $query->($modules[0]);
-        } else {
-            for my $m (@modules) {
-                say "$m: ", $query->($m);
-            }
+        for my $m (@modules) {
+            say "$m: ", $query->($m);
         }
 
         return 0;
diff --git a/modules/ksb/Cmdline.pm b/modules/ksb/Cmdline.pm
index 055676b8..efb13ab2 100644
--- a/modules/ksb/Cmdline.pm
+++ b/modules/ksb/Cmdline.pm
@@ -198,11 +198,6 @@ sub readCommandLineOptionsAndSelectors (@options)
             die("Invalid query mode $arg")
                 unless $arg =~ $validMode;
 
-            # Add useful aliases
-            $arg = 'source-dir'  if $arg =~ /^src-?dir$/;
-            $arg = 'build-dir'   if $arg =~ /^build-?dir$/;
-            $arg = 'install-dir' if $arg =~ /^install-?dir$/;
-
             $opts->{run_mode} = 'query';
             $auxOptions{query} = $arg;
             $auxOptions{pretend} = 1; # Implied pretend mode



More information about the kde-doc-english mailing list