On 08/06/2010 03:34 PM, f...@kokkinizita.net wrote:
On Fri, Aug 06, 2010 at 05:11:27PM +0100, ni...@greenlemur.com wrote:

On Thu, Aug 05, 2010 at 10:51:45PM -0500, David C. Rankin wrote:

http://www.3111skyline.com/dl/Archlinux/scripts/srch2list.sh

I'm new to Arch and to the list but wanted to say thanks for posting
this up. I've found pacman a great tool for getting what I need
installed, but browsing and looking around it was tricky - this script
is really useful for that.

Nice. But why not read from stdin if no file is given, e.g.

    pacman -Ss ttf | srch2list.sh


Actually I'm working on just passing the script the search term and calling pacman from within the script. The problem with piping the output into the script is it messed up my terminal size calcs (stty doesn't like the script taking input from stdin) and one of the primary goals I had for the script was for it to dynamically size the output based on (1) the longest filename returned (to set column 1 width) and (2) to size the description column using the remainder of the terminal width leaving the 1 char margin. So keeping the ability to grab the terminal size from stty was key.

I'm working to learn the "why's" of stty seeing things as a file and not a tty when piping input from stdin, but I'm not there yet. I'll update the input routine for the script so it will be flexible enough to take a search term, a saved search file and/or have it prompt for the search term or filename using zenity or stdin. That will get the script to where I want it to be. But knowing my schedule (and distractions from 3 kids) I thought I would go ahead and post the reformatting part so some use could be made of it until I have an hour or two to work out the final input.

--
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

Reply via email to