From: Cyril Roelandt Date: Wed, 7 Jun 2023 12:33:19 +0000 (+0200) Subject: Fix zsh completion for "localectl set-locale" X-Git-Tag: v254-rc1~263 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3c6fefd8791940c4ea3b15ed68458868edfbc243;p=thirdparty%2Fsystemd.git Fix zsh completion for "localectl set-locale" When running: $ localectl set-locale LC_MESSAGES= 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 --- diff --git a/shell-completion/zsh/_localectl b/shell-completion/zsh/_localectl index 23422a9a4e6..65babe2c083 100644 --- a/shell-completion/zsh/_localectl +++ b/shell-completion/zsh/_localectl @@ -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 "$@" -