[PATCH bash ordered autocomplete] Order the autocompletion in bash

Reed Wade reedwade at misterbanal.net
Tue Mar 31 19:12:09 CEST 2020


> --- a/src/completion/pass.bash-completion
> +++ b/src/completion/pass.bash-completion
> @@ -4,7 +4,21 @@
>  # Brian Mattern <rephorm at rephorm.com>. All Rights Reserved.
>  # This file is licensed under the GPLv2+. Please see COPYING for more information.
>
> +_sort_entries_string () {
> +	echo $1 | tr ' ' '\n' | sort | tr '\n' ' '

Be carreful and almost always enquote your variables usages in shell
scripts.

> +}
> +
> +_append_to_compreply () {
> +	sorted_crrt_compreply_entries=$(_sort_entries_string $1)

enquote $(_sort_entries_string $1)

> +	local IFS=" "

Is it really necessary? Unset IFS is equal to spaces, tab and newline.

> +	for word in ${sorted_crrt_compreply_entries}; do

You could probably remove the tmp variable and directly call
_sort_entries_string here.

rest lgtm


More information about the Password-Store mailing list