[bash] Fix completion of var or alias containing newlines (#2952)

* Fix bash completion var or aliase containing newlines

* Support for various bash declare options

Co-authored-by: knutze <shakte@gmail.com>
This commit is contained in:
knutze 2022-09-10 11:38:41 +09:00 committed by GitHub
parent 845034c81c
commit b9e6e7926c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -288,13 +288,13 @@ _fzf_host_completion() {
_fzf_var_completion() {
_fzf_complete -m -- "$@" < <(
declare -xp | sed 's/=.*//' | sed 's/.* //'
declare -xp | sed -En 's|^declare [^ ]+ ([^=]+).*|\1|p'
)
}
_fzf_alias_completion() {
_fzf_complete -m -- "$@" < <(
alias | sed 's/=.*//' | sed 's/.* //'
alias | sed -En 's|^alias ([^=]+).*|\1|p'
)
}