From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Thu, 27 Jan 2022 16:59:11 +0300 From: "Dmitry V. Levin" To: ALT Devel discussion list Message-ID: <20220127135911.GB19078@altlinux.org> References: <20220127131702.071FF84405A7@gitery.altlinux.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220127131702.071FF84405A7@gitery.altlinux.org> Subject: Re: [devel] [SCM] packages/control: heads/sisyphus X-BeenThere: devel@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: ALT Linux Team development discussions List-Id: ALT Linux Team development discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jan 2022 13:59:11 -0000 Archived-At: List-Archive: List-Post: On Thu, Jan 27, 2022 at 01:17:01PM +0000, Andrey Limachko wrote: > Update of /people/liannnix/packages/control.git [...] > diff --git a/control/control.bash_completion b/control/control.bash_completion > new file mode 100644 > index 0000000..6f35d9c > --- /dev/null > +++ b/control/control.bash_completion > @@ -0,0 +1,17 @@ > +#!/bin/bash > + > +_control_completions() > +{ > + local facilities_fullpath=($(compgen -A file /etc/control.d/facilities/)) > + local facilities=(${facilities_fullpath[@]##*/}) > + facilities=(${facilities[@]##.*}) Непонятно, зачем понадобилась последняя строка. > + if [[ ${#COMP_WORDS[@]} -le 3 && ${COMP_CWORD} -eq 1 ]]; then > + COMPREPLY=($(compgen -W "${facilities[*]}" "${COMP_WORDS[1]}")) > + elif [[ ${#COMP_WORDS[@]} -eq 3 && ${COMP_CWORD} -eq 2 && " ${facilities[*]} " == *" ${COMP_WORDS[1]} "* ]]; then Эта строка длинновата, надо сделать перенос. > + local current_facility=${COMP_WORDS[1]} > + local actions=($(${COMP_WORDS[0]} ${current_facility} list)) > + COMPREPLY=($(compgen -W "${actions[*]}" "${COMP_WORDS[2]}")) А не проще ли написать "${COMP_WORDS[0]} ${COMP_WORDS[1]} list" чем две строки присваиваний с последующим "${actions[*]}"? -- ldv