ALT Linux Team development discussions
 help / color / mirror / Atom feed
* Re: [devel] [SCM] packages/control: heads/sisyphus
  @ 2022-01-27 13:59 ` Dmitry V. Levin
  0 siblings, 0 replies; only message in thread
From: Dmitry V. Levin @ 2022-01-27 13:59 UTC (permalink / raw)
  To: ALT Devel discussion list

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-01-27 13:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-27 13:59 ` [devel] [SCM] packages/control: heads/sisyphus Dmitry V. Levin

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