diff mbox series

[bug#51373] etc: completion: Filter gratuitous spaces from available packages.

Message ID c0d4144fd32fbb11b7b057438dd9342f375b232c.camel@gmail.com
State Accepted
Headers show
Series [bug#51373] etc: completion: Filter gratuitous spaces from available packages. | expand

Checks

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

Commit Message

Liliana Marie Prikler Oct. 24, 2021, 12:09 p.m. UTC
* etc/completion/zsh/_guix (_guix_list_available_packages): Add a sed filter
to remove spaces.
---
 etc/completion/zsh/_guix | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Tobias Geerinckx-Rice Oct. 24, 2021, 1:43 p.m. UTC | #1
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 Oct. 24, 2021, 1:57 p.m. UTC | #2
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
Liliana Marie Prikler Oct. 24, 2021, 2:47 p.m. UTC | #3
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
Tobias Geerinckx-Rice Oct. 24, 2021, 7:01 p.m. UTC | #4
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 mbox series

Patch

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
 }