Closed ScriptJunky closed 3 years ago
Grep -B1
although I don't see why you would use grep anyway when the whole point of Ss is to search. Just search for what you want.
I am well aware of both grep -B1
, and grep -A1
. When you have more than 2 responses, your grep could match the description, or it could match the name. In both cases, you need to see both the app name, and the description.
Here's an example of how bad this can be;
{00:24:26 05/23/21}:@~ ✗ yay -Ss video | grep -A1 kde
aur/kdenlive-testing-git 19.03.70.r10665.4fc2f242e-1 (+0 0.00)
A non-linear video editor. Following the refactoring timeline branch in git.
--
aur/kde-thumbnailer-mp4cover 0.2-1 (+0 0.00)
MP4 video cover art thumbnail generator
--
aur/kdenlive-release-git 21.03.80.r14168-1 (+0 0.00)
A non-linear video editor. Following latest released branch in git.
--
aur/telepathy-kde-call-ui-git v20.04.2.r0.g8815182-1 (+1 0.00)
Voice/Video Call UI for Telepathy
--
aur/kde-servicemenus-video-dl 0.3.3-1 (+3 0.00)
Servicemenu for KDE to download videos and extract its audio
--
aur/kdenlive-appimage 21.04.0-0 (+4 0.12)
A non-linear video editor for Linux using the MLT video framework
--
aur/kde-servicemenus-youtube 1.12a-1 (+7 0.00)
Konqueror/KDE service menu to download youtube videos
--
aur/clipgrab-kde 3.8.14-1 (+8 0.00) (Orphaned) (Out-of-date: 2021-03-21)
A video downloader and converter for YouTube, Veoh, DailyMotion, MyVideo, ...
--
aur/kdenlive-git 21.07.70.r14404-1 (+63 0.01)
A non-linear video editor for Linux using the MLT video framework. KF5 Frameworks (Latest Applications GIT Version)
--
extra/telepathy-kde-call-ui 21.04.0-1 (194.0 KiB 717.6 KiB) [kde-applications kde-network telepathy-kde]
Voice/Video Call UI for Telepathy
--
extra/kdenlive 21.04.0-3 (12.8 MiB 63.0 MiB) [kde-applications kde-multimedia]
A non-linear video editor for Linux using the MLT video framework
--
extra/ffmpegthumbs 21.04.0-1 (34.2 KiB 99.9 KiB) [kde-applications kde-multimedia] (Installed)
FFmpeg-based thumbnail creator for video files
{00:24:32 05/23/21}:@~ ✗ yay -Ss video | grep -B1 kde
Professional video editing and compositing environment - Community version
aur/kdenlive-testing-git 19.03.70.r10665.4fc2f242e-1 (+0 0.00)
--
Jamm is a lightweight video collaboration app for remote teams
aur/kde-thumbnailer-mp4cover 0.2-1 (+0 0.00)
--
Python 3 library for downloading YouTube Videos.
aur/kdenlive-release-git 21.03.80.r14168-1 (+0 0.00)
--
XAVS is to implement high quality encoder and decoder of the Audio Video Standard of China (AVS).
aur/telepathy-kde-call-ui-git v20.04.2.r0.g8815182-1 (+1 0.00)
--
A new generation, open-source graphics plugin for N64 emulators (git version)
aur/kde-servicemenus-video-dl 0.3.3-1 (+3 0.00)
--
Creates colorful timebars from video and audio files, comes with a shared C library. Inspired by the moviebarcode tumblr.
aur/kdenlive-appimage 21.04.0-0 (+4 0.12)
--
Get URLs of Czech Television video streams for specific entry page
aur/kde-servicemenus-youtube 1.12a-1 (+7 0.00)
--
A C library that provides a wrapper around Libav’s video and audio decoding functionality
aur/clipgrab-kde 3.8.14-1 (+8 0.00) (Orphaned) (Out-of-date: 2021-03-21)
--
Video Acceleration (VA) API for Linux
aur/kdenlive-git 21.07.70.r14404-1 (+63 0.01)
--
Userspace tools and conversion library for Video 4 Linux
extra/telepathy-kde-call-ui 21.04.0-1 (194.0 KiB 717.6 KiB) [kde-applications kde-network telepathy-kde]
--
Open source implementation of Audio Video Transport Protocol
extra/kdenlive 21.04.0-3 (12.8 MiB 63.0 MiB) [kde-applications kde-multimedia]
--
Collection of GStreamer effects for GNOME
extra/ffmpegthumbs 21.04.0-1 (34.2 KiB 99.9 KiB) [kde-applications kde-multimedia] (Installed)
If the screen real estate is there, why do we need to suffer with a condensed, multi-line output? Also, until yay supports regex (does it? My understanding here may be incorrect), grep is the only good way to filter the list in place, and with multi-line, it's not as effective as it could be.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This would be a nice addition. Meanwhile, I will just use an alias or something I guess.
Thanks much @Jguer for moving this over to a feature request!
One workaround would be to pipe the output through paste - -
:
% yay -Ss gnome | paste - -
aur/gnome-shell-extension-zorin-panel 1.6.1_all-1 (+0 0.00) (Out-of-date: 2021-04-28) Various settings and changes for the panel in Zorin Desktop.
aur/gsql 0.2.2-14 (+0 0.00) (Orphaned) Integrated database development tool for GNOME
aur/gnome-documents-git 3.34.0+7+g1baebf09-1 (+0 0.00) A document manager application for GNOME
[...]
I'm doing something similar (not as simplified as paste, though);
{8:46}~ ➭ tail -7 .zshrc
function yaysearch () {
yay -Ss $1 | while read package;
do read description
echo -e "$package\t$description"
done | column -s" " -t
}
{8:46}~ ➭
Specifying tab character as separator in column, so that it aligns the text cleanly.
Arms race :-)
#!/bin/sh
#
# Parse pacman/yay search results for easier grepping
#
# pacman -Ss intellij | pacsearchparse
# yay -Ss intellij | pacsearchparse
# yay -Ss intellij --color=always | pacsearchparse
set -euo pipefail
search='^'
search+='([^\/]+)\/' # match 1: repo
search+='([^ ]+) ' # match 2: package name
search+='([^ ]+) ' # match 3: version
search+='(.*)? {2,}' # match 5: tags (optional and different between pacman and yay)
search+='(.*)' # match 6: description
paste - - |
perl -pe 's/'"${search}"'/\1\|\2\|\5 (\3) \4/' |
column -t -s'|' -o' '
What yay really needs is something like expac. Or maybe yay support built into expac.
Here's what things look like currently;
The above is horrific. If I am looking for a package, I need to assume my grep work is going to match either the package name, or the description, but not both at the same time.
Ideally, this is what we should see;
With the above I can find packages that match on either the package name, OR the description, which is MUCH better.