From: "Dmitry V. Levin" <ldv@altlinux.org> To: ALT Devel discussion list <devel@lists.altlinux.org> Subject: Re: [devel] [SCM] packages/control: heads/sisyphus Date: Thu, 27 Jan 2022 16:59:11 +0300 Message-ID: <20220127135911.GB19078@altlinux.org> (raw) In-Reply-To: <20220127131702.071FF84405A7@gitery.altlinux.org> 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
parent reply other threads:[~2022-01-27 13:59 UTC|newest] Thread overview: expand[flat|nested] mbox.gz Atom feed [parent not found: <20220127131702.071FF84405A7@gitery.altlinux.org>]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220127135911.GB19078@altlinux.org \ --to=ldv@altlinux.org \ --cc=devel@lists.altlinux.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
ALT Linux Team development discussions This inbox may be cloned and mirrored by anyone: git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \ devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru public-inbox-index devel Example config snippet for mirrors. Newsgroup available over NNTP: nntp://lore.altlinux.org/org.altlinux.lists.devel AGPL code for this site: git clone https://public-inbox.org/public-inbox.git