Git commit 733b492414f2c1e49986106070f05cf68cd1a752 by Andrew Shark.
Committed on 17/02/2024 at 14:09.
Pushed by ashark into branch 'master'.

Move --list-installed to kdesrc-build

M  +1    -0    completions/zsh/_kdesrc-build
M  +1    -1    data/kdesrc-run-completions.sh
M  +9    -0    doc/supported-cmdline-params.docbook
M  +1    -10   kdesrc-run
M  +6    -0    modules/ksb/Application.pm
M  +1    -0    modules/ksb/Cmdline.pm
M  +1    -0    scripts/gen_zsh_completions.py

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

diff --git a/completions/zsh/_kdesrc-build b/completions/zsh/_kdesrc-build
index e563f53d..bc8202e4 100644
--- a/completions/zsh/_kdesrc-build
+++ b/completions/zsh/_kdesrc-build
@@ -49,6 +49,7 @@ _arguments \
   "(--install-session-driver 
--no-install-session-driver)"{--install-session-driver,--no-install-session-driver}"[Install
 a driver for the graphical login manager]" \
   "--libname""[Default name of the installed library directory]"":argument:" \
   "--libpath""[Set the environment variable LD_LIBRARY_PATH while 
building]"":argument:" \
+  "--list-installed""[Print installed modules and exit]" \
   "--log-dir""[Directory used to hold the log files generated by the 
script]"":argument:" \
   "--make-install-prefix""[A command and its options to precede the make 
install command used to install modules]"":argument:" \
   "--make-options""[Pass command line options to the make 
command]"":argument:" \
diff --git a/data/kdesrc-run-completions.sh b/data/kdesrc-run-completions.sh
index a49319d2..47e222ff 100644
--- a/data/kdesrc-run-completions.sh
+++ b/data/kdesrc-run-completions.sh
@@ -14,7 +14,7 @@ function _comp_kdesrc_run
   # If the exit status indicates failure, set the wordlist empty to avoid
   # unrelated messages.
   local modules
-  if ! modules=$(kdesrc-run --list-installed);
+  if ! modules=$(kdesrc-build --list-installed);
   then
       modules=""
   fi
diff --git a/doc/supported-cmdline-params.docbook 
b/doc/supported-cmdline-params.docbook
index a6d1a9aa..fb02d2d3 100644
--- a/doc/supported-cmdline-params.docbook
+++ b/doc/supported-cmdline-params.docbook
@@ -350,6 +350,15 @@ kdepim: master
 </listitem>
 </varlistentry>
 
+<varlistentry id="cmdline-list-installed">
+<term><option><link 
linkend="cmdline-list-installed">--list-installed</link></option></term>
+<listitem>
+<para>
+Print installed modules and exit. This can be used to generate autocompletion 
for the --run option.
+</para>
+</listitem>
+</varlistentry>
+
 </variablelist>
 </sect2>
 
diff --git a/kdesrc-run b/kdesrc-run
index b27d82a1..90c55560 100755
--- a/kdesrc-run
+++ b/kdesrc-run
@@ -18,7 +18,6 @@ kdesrc-run [options] <module-name> [arguments]
   -f, --fork              Launch the program in a new session.
   -q, --quiet             Do not print run information.
   -h, --help              Print usage information and exit.
-  --list-installed        Print installed modules and exit.
 
 =head1 EXAMPLES
 
@@ -49,17 +48,15 @@ our $optExec;
 our $optFork          = 0;
 our $optHelp          = 0;
 our $optQuiet         = 0;
-our $optListInstalled = 0;
 
 GetOptions(
     'exec|e=s'       => \$optExec,
     'fork|f'         => \$optFork,
     'help|h'         => sub { pod2usage(0); },
     'quiet|q'        => \$optQuiet,
-    'list-installed' => \$optListInstalled,
 );
 
-if ($#ARGV == -1 && not $optListInstalled) {
+if ($#ARGV == -1) {
     pod2usage(0);
 }
 
@@ -84,12 +81,6 @@ my $buildData = do {
     decode_json(<$fh>);
 };
 
-if ($optListInstalled) {
-    say foreach sort { $a cmp $b }
-        grep { defined $buildData->{$_}{'install-dir'} } keys %$buildData;
-    exit;
-}
-
 if (not defined $buildData->{$module}) {
     say qq(Module "$module" has not been built yet.);
     exit 1;
diff --git a/modules/ksb/Application.pm b/modules/ksb/Application.pm
index 53cf4431..952f3f8f 100644
--- a/modules/ksb/Application.pm
+++ b/modules/ksb/Application.pm
@@ -311,6 +311,12 @@ EOF
         unshift @selectors, split(/,\s*/, $moduleList);
     }
 
+    if (exists $cmdlineGlobalOptions->{"list-installed"}) {
+        say foreach sort { $a cmp $b }
+            grep { defined $ctx->{persistent_options}->{$_}{'install-dir'} } 
keys %{$ctx->{persistent_options}};
+        exit;
+    }
+
     my %ignored_in_global_section =
         map { $_, 1 } split(" ", $ctx->{options}->{"ignore-modules"});
     $ctx->{options}->{"ignore-modules"} = "";
diff --git a/modules/ksb/Cmdline.pm b/modules/ksb/Cmdline.pm
index a7d6e51b..2950c890 100644
--- a/modules/ksb/Cmdline.pm
+++ b/modules/ksb/Cmdline.pm
@@ -426,6 +426,7 @@ sub _supportedOptions
         'dependency-tree',
         'dependency-tree-fullpath',
         'help|h',
+        "list-installed",
         'metadata-only',
         'no-metadata|M',
         'query=s',
diff --git a/scripts/gen_zsh_completions.py b/scripts/gen_zsh_completions.py
index 545a9d9f..64a392c5 100644
--- a/scripts/gen_zsh_completions.py
+++ b/scripts/gen_zsh_completions.py
@@ -142,6 +142,7 @@ short_descriptions = {  # contains one of the options (any 
of them) from set, an
     "--generate-vscode-project-config": "Generate a vscode project config",
     "--help": "Displays help on commandline options",
     "--http-proxy": "Use specified URL as a proxy server for any HTTP network 
communications",
+    "--list-installed": "Print installed modules and exit",
     "--ignore-modules": "Do not include specified modules in the update/build 
process",
     "--include-dependencies": "Builds/Skip KDE-based dependencies",
     "--initial-setup": "Installs Plasma env vars (~/.bashrc), required system 
pkgs, and a base kdesrc-buildrc",

Reply via email to