[PATCH] etc: completion: Filter gratuitous spaces from available packages.

  • Done
  • quality assurance status badge
Details
2 participants
  • Liliana Marie Prikler
  • Tobias Geerinckx-Rice
Owner
unassigned
Submitted by
Liliana Marie Prikler
Severity
normal
L
L
Liliana Marie Prikler wrote on 24 Oct 2021 14:09
(address . guix-patches@gnu.org)
c0d4144fd32fbb11b7b057438dd9342f375b232c.camel@gmail.com
* 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(-)

Toggle diff (15 lines)
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
}
--
2.33.1
T
T
Tobias Geerinckx-Rice wrote on 24 Oct 2021 15:43
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)
87zgqyilg5.fsf@nckx
Liliana Marie Prikler ???
Toggle quote (3 lines)
> + _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
-----BEGIN PGP SIGNATURE-----

iIMEARYKACsWIQT12iAyS4c9C3o4dnINsP+IT1VteQUCYXVj6g0cbWVAdG9iaWFz
LmdyAAoJEA2w/4hPVW15NDEA/1M7ewpJ7+Hs6ynrEcLfhoNUu9FzpO35lxzsgqhY
BusIAQDNGqZ8qj98ONPQZ/CKT/MMi751+ukcKxwIiULpGMVpCQ==
=gjjw
-----END PGP SIGNATURE-----

T
T
Tobias Geerinckx-Rice wrote on 24 Oct 2021 15:57
87wnm2ikxm.fsf@nckx
Tobias Geerinckx-Rice via Guix-patches via ???
Toggle quote (3 lines)
> 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
-----BEGIN PGP SIGNATURE-----

iIMEARYKACsWIQT12iAyS4c9C3o4dnINsP+IT1VteQUCYXVmhQ0cbWVAdG9iaWFz
LmdyAAoJEA2w/4hPVW15DssA/RXWvIDwTHtgbTsjVfmDY6PDnnC5Mvwl1jmeRJ2M
0QjIAP4iKxUye73B1CEPpDV5nSkYaKeWeoQUV70zcHJhl2ZuCw==
=D0D/
-----END PGP SIGNATURE-----

L
L
Liliana Marie Prikler wrote on 24 Oct 2021 16:47
(name . Tobias Geerinckx-Rice)(address . me@tobias.gr)(address . 51373@debbugs.gnu.org)
344a41f281c0abaec9533f0b683c9b3bde16ffa9.camel@gmail.com
Am Sonntag, den 24.10.2021, 15:57 +0200 schrieb Tobias Geerinckx-Rice:
Toggle quote (6 lines)
> 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
T
T
Tobias Geerinckx-Rice wrote on 24 Oct 2021 21:01
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)(address . 51373-done@debbugs.gnu.org)
87wnm29rdz.fsf@nckx
Liliana Marie Prikler ???
Toggle quote (4 lines)
> 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.

Toggle quote (6 lines)
> 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
-----BEGIN PGP SIGNATURE-----

iIMEARYKACsWIQT12iAyS4c9C3o4dnINsP+IT1VteQUCYXWuGQ0cbWVAdG9iaWFz
LmdyAAoJEA2w/4hPVW155QEBANbrHjSl77G1JUjePovJF+DfiaOxnoEETtrq6yja
3SAkAP9/1UYcBnbyjNeLPf6+orxnJ9sZCNryG2E0Fb5EePh8CA==
=EjcE
-----END PGP SIGNATURE-----

Closed
?