Message ID | c0d4144fd32fbb11b7b057438dd9342f375b232c.camel@gmail.com |
---|---|
State | Accepted |
Headers | show |
Series | [bug#51373] etc: completion: Filter gratuitous spaces from available packages. | expand |
Context | Check | Description |
---|---|---|
cbaines/comparison | success | View comparision |
cbaines/git branch | success | View Git branch |
cbaines/applying patch | success | View Laminar job |
cbaines/issue | success | View issue |
Liliana Marie Prikler 写道: > + _guix_available_packages=(${${(f)"$(guix package -A | > cut -f1 | sed -e 's/ //g')"}}) Does ZSH support something like bash's "${foo[@]// /}"" to avoid spawning sed altogether? Otherwise LGTM! Kind regards, T G-R
Tobias Geerinckx-Rice via Guix-patches via 写道: > Does ZSH support something like bash's "${foo[@]// /}"" to avoid > spawning sed altogether? It *seems* equivalent, which is as much as I dare say of anything ZSH. Kind regards, T G-R
Am Sonntag, den 24.10.2021, 15:57 +0200 schrieb Tobias Geerinckx-Rice: > Tobias Geerinckx-Rice via Guix-patches via 写道: > > Does ZSH support something like bash's "${foo[@]// /}"" to avoid > > spawning sed altogether? > > It *seems* equivalent, which is as much as I dare say of anything > ZSH. Haha, yeah, zsh can be weird at times. I typically don't play around with such fancy syntax all that much so on the top of my head I wouldn't even know how to rewrite my patch using that. However, if it helps not spawning a process like once during compinit, then go ahead and use your version :) Thanks, Liliana
Liliana Marie Prikler 写道: > Haha, yeah, zsh can be weird at times. I typically don't play > around > with such fancy syntax all that much so on the top of my head I Your sanity is duly envied. > wouldn't even know how to rewrite my patch using that. However, > if it > helps not spawning a process like once during compinit, then go > ahead > and use your version :) There are plenty of other seds littering the file—though not this trivial. At least commit 55f6d9e818512b4e3e4adacfa99deb201b6854be avoids one more. Thanks! T G-R
diff --git a/etc/completion/zsh/_guix b/etc/completion/zsh/_guix index bbc13c6ca1..6b4060ddeb 100644 --- a/etc/completion/zsh/_guix +++ b/etc/completion/zsh/_guix @@ -57,7 +57,7 @@ _guix_list_available_packages() { if ( [[ ${+_guix_available_packages} -eq 0 ]] || _cache_invalid GUIX_AVAILABLE_PACKAGES ) \ && ! _retrieve_cache GUIX_AVAILABLE_PACKAGES; then - _guix_available_packages=(${${(f)"$(guix package -A | cut -f1)"}}) + _guix_available_packages=(${${(f)"$(guix package -A | cut -f1 | sed -e 's/ //g')"}}) _store_cache GUIX_AVAILABLE_PACKAGES _guix_available_packages fi }