[arch-general] script to reformat 'pacman -Ss' output into 2 readable columns (prevents blindness)

David C. Rankin drankinatty at suddenlinkmail.com
Tue Aug 10 22:31:42 EDT 2010


On 08/10/2010 05:29 PM, David C. Rankin wrote:
> On 08/10/2010 03:46 PM, David C. Rankin wrote:
>> On 08/05/2010 10:51 PM, David C. Rankin wrote:
>>> Guys,
>>>
>>> I developed a script to help me read the output of pacman -Ss in 2 nicely
>>> formatted columns. The output of 'pacman -Ss srchterm' drives me nuts trying to
>>> read down the package names and descriptions with all the tab indented and
>>> wrapped text -- so I fixed it. Download the script here:
>>>
>>> http://www.3111skyline.com/dl/Archlinux/scripts/srch2list.sh
>>>
>> <snip>
>>>

	Whew - I have finally worked out the zenity install routine and I like it. I 
have also added the -n | --notext option that suppresses output of the list of 
search packages to the console. It is primarily for use with the -z | --zenity 
switch to allow the program to be run as a graphical program. Try it:

srch2list.sh srchterm (or saved filename) -z -n

and this will provide a graphical list with a checkbox for each package. You can 
select any number of packages you would like to install. Clicking 'Cancel' 
exits. Clicking 'OK' will bring up a confirmation dialog with the selected 
packages so the user can confirm the install --or-- modify the selection. 
Clicking 'Cancel' will again exit. Clicking 'OK' here will call pacman -Sy <list 
of packages> or will try 'sudo pacman' if run by other than root.

The new option list is:

   Options:

     NOTE: options can be given in any order, flags must be separate: '-d -z' 
NOT '-dz'

     -c | --color           disable the use of an accent color for pkgnames.
     -d | --double          option controls single/double spaced output.
     -h | --help            display this help message.
     -i | --installed       show only installed packages.
     -n | --notext          don't output list to console (use with -z).
     -u | --uninstalled     show only uninstalled packages.
     -w | --write filename  write search results to 'filename'.
     -z | --zenity          provide graphical output using 'zenity --list' 
(requires zenity)

   Two additional testing options (no effect on script):

     -v | --verbose         dump select variables to the screen.
     -a | --array           dump the array contents to the screen (requires -v 
option)

CHANGELOG: version 0.0.5

   - Added to -n | --notext switch to suppress output of the list to the console
   - Added the ability to (1) select packages in the zenity list for install
   - Added confirm install dialog that allows modification and confirmation of 
packages to install with pacman -Sy

TODO:

   - Perhaps add an initial searchterm or filename zenity dialog so this script 
can simply be run from a launcher on your desktop.

	Let me know if this is something that should be added to AUR or somewhere for 
people to find long after this email thread has died.

Enjoy :p

-- 
David C. Rankin, J.D.,P.E.
Rankin Law Firm, PLLC
510 Ochiltree Street
Nacogdoches, Texas 75961
Telephone: (936) 715-9333
Facsimile: (936) 715-9339
www.rankinlawfirm.com


More information about the arch-general mailing list