[arch-general] script to reformat 'pacman -Ss' (2nd Version)
David C. Rankin
drankinatty at suddenlinkmail.com
Mon Aug 9 00:56:12 EDT 2010
On 08/07/2010 03:52 AM, Simon Stoakley wrote:
> Been messing around with this a little, added pacman -Qs option, single space
> option (-d default) and some colours. Wrapped it in a function so can call it
> pacside [-qs] schstring.
> Thought I'd put it back up in case anyone's interested.
As discussed earlier, I have re-written the input routine and add a number of
new capabilities to the original script I did. The biggest change is the script
now simply accepts a searchTerm and calls pacman -Ss from within the script. You
can still pass the script a saved search file and it will parse it as it did
What is really cool (I think), is that you can specify the command line
parameters "In Any Order" and NO flags are necessary to tell the script whether
to call pacman or read a file for results. If the file exists, the script reads
it, if no file matching the command line parameter exists, then it calls pacman.
The new version is here:
Just run it without options or with -h | --help to get the full usage information:
Usage: srch2list.sh srchTerm [srchfName] [-d|--double] [-h|--help]
[-z|--zenity] [-w|--write filename]
srch2list.sh provides formatted output for 'pacman -Ss srchTerm'. The output is
provided in two columns (package name)(description). The columns are dynamically
sized so the package name column is wide enough for the longest package name
returned, and the description fills the remaining space provided by the terminal
while leaving a one character margin at the right-hand side. You can now read
the search results without going blind.
The script will also parse a previous pacman search saved with 'pacman -Ss
>srchfName.' If you provide both a srchTerm and srchfName, the search will be
performed and the srchfName ignored. The remaining options are as follows:
NOTE: options can be given in any order, flags must be separate: '-d -z'
-d | --double option controls single/double spaced output.
-h | --help display this help message.
-w | --write filename write search results to 'filename'.
-z | --zenity provide graphical output using 'zenity --list'
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
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
More information about the arch-general