Re: [PATCH 4/8] bash: Add space after unique command name is completed.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Shawn O. Pearce" <spearce@xxxxxxxxxxx> writes:

> +__gitcomp ()
> +{
> +	local all c s=$'\n' IFS=' '$'\t'$'\n'
> +	for c in $1; do
> +		case "$c" in
> +		--*=*) all="$all$c$s" ;;
> +		*)     all="$all$c $s" ;;
> +		esac
> +	done
> +	IFS=$s
> +	COMPREPLY=($(compgen -W "$all" -- "${COMP_WORDS[COMP_CWORD]}"))
> +	return
> +}
> +

I do not understand what is going on here.  Care to explain?

 (1) "for c in $1": because $1 is not dquoted, it is split into
     word with IFS -- which IFS applies to this splitting?  The
     local one you hand-define to the typical " \t\n" value?

 (2) when this function returns, what IFS value does the caller
     would have?  Is the "local" used to avoid screwing up the
     caller?


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]