]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Fix zsh completion for "localectl set-locale"
authorCyril Roelandt <cyril@redhat.com>
Wed, 7 Jun 2023 12:33:19 +0000 (14:33 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Wed, 7 Jun 2023 12:54:12 +0000 (13:54 +0100)
When running:

    $ localectl set-locale LC_MESSAGES=<TAB>

One is prompted with a list of locale fields instead of the list of
valid locales. This is because by calling "compset -P1 '*='", we modify
the $PREFIX special parameter before testing whether it contains an
equal sign. Therefore

    if [[ -prefix 1 *\= ]]

is always false, and we always suggest a list of locale fields to the
user.

Fixes: #27955
shell-completion/zsh/_localectl

index 23422a9a4e61070aad2a20056dca5594ededc03c..65babe2c083bdc7227d9da08b40a3e8309b6eb3f 100644 (file)
@@ -12,8 +12,8 @@ _localectl_set-locale() {
 
     local expl suf
     _locales=( ${(f)"$(_call_program locales "$service" list-locales)"} )
-    compset -P1 '*='
     if [[ -prefix 1 *\= ]]; then
+        compset -P1 '*='
         local conf=${PREFIX%%\=*}
         _wanted locales expl "locales configs" \
             _combination localeconfs  confs=$conf locales "$@" -