You are not logged in.

#1 2018-04-22 10:36:56

MS1
Member
Registered: 2018-02-02
Posts: 84

Pacman command to see description of all group members

I want to install the group plasma that has 42 members. Is there a pacman command or stringed together commands to see each member and it's description so I can know which of them I want to get?

:: There are 42 members in group plasma:
:: Repository extra
   1) bluedevil  2) breeze  3) breeze-gtk  4) discover  5) drkonqi  6) kactivitymanagerd  7) kde-cli-tools  8) kde-gtk-config
   9) kdecoration  10) kdeplasma-addons  11) kgamma5  12) khotkeys  13) kinfocenter  14) kmenuedit  15) knetattach  16) kscreen
   17) kscreenlocker  18) ksshaskpass  19) ksysguard  20) kuiserver  21) kwallet-pam  22) kwayland-integration  23) kwin
   24) kwrited  25) libkscreen  26) libksysguard  27) milou  28) oxygen  29) plasma-desktop  30) plasma-integration
   31) plasma-nm  32) plasma-pa  33) plasma-sdk  34) plasma-vault  35) plasma-workspace  36) plasma-workspace-wallpapers
   37) polkit-kde-agent  38) powerdevil  39) sddm-kcm  40) systemsettings  41) user-manager  42) xdg-desktop-portal-kde

Enter a selection (default=all): 

Offline

#2 2018-04-22 10:44:22

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,597
Website

Re: Pacman command to see description of all group members

There is probably a more elegant solution, but quick n' dirty and before I've had my AM coffee:

#!/bin/bash
arr=( $(pacman -Sg plasma | awk '{ print $2 }' | sed ':a;N;$!ba;s/\n/ /g') )
for i in "${arr[@]}"; do
  pacman -Ss "$i"
done

EDIT: no, that doesn't work as expected since it's a wildcard search.

Last edited by graysky (2018-04-22 10:48:11)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#3 2018-04-22 10:47:20

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,845
Website

Re: Pacman command to see description of all group members

pacman -Si $(pacman -Sqg plasma) | grep -E "^Name|^Desc"

Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#4 2018-04-22 10:53:24

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: Pacman command to see description of all group members

Whoa, holy useless pipeline batman!

pacman -Sg plasma | awk '{ print $2;}'
# no, that should be the following
pacman -Sgq plasma
# as for that sed line, that's a horrific way to just remove newlines.  The following could suffice
pacman -Sgq plasma | tr '\n' ' '
# of course this is also completely pointless as this will work too
arr=( $(pacman -Sgq plasma) )

But while a for loop through the contents of that array will get the job done, this seems much cleaner to me:

pacman -Si $(pacman -Sgq plasma) | sed -n 's/^Name *: //p;s/^Description *: /\t/p'

You could adjust the sed command if you really wanted pacman-like coloring.

Also the while loop could work, but the internals should not be `pacman -Ss` as that will return *far* to many false-positive results.

Last edited by Trilby (2018-04-22 10:55:49)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Online

#5 2018-04-22 13:13:56

a821
Member
Registered: 2012-10-31
Posts: 381

Re: Pacman command to see description of all group members

expac -Sg "%n: %d" plasma

Offline

#6 2018-04-22 15:24:17

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: Pacman command to see description of all group members

Not as fast as expac, but if you want to get the same result with sed (without requiring expac):

zcat /var/lib/pacman/sync/*.db  | sed -n '/%NAME%/{n;h;} /%DESC%/{n;H;} /%GROUPS%/{n;/plasma/{x;s/\n/: /p;}}'

Last edited by Trilby (2018-04-22 15:25:40)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Online

Board footer

Powered by FluxBB