How do I search inside long descriptions

Ryan Schmidt ryandesign at macports.org
Wed Jun 20 03:40:46 PDT 2007


On Jun 19, 2007, at 11:22, James Berry wrote:

> On Jun 19, 2007, at 9:17 AM, Emmanuel Hainry wrote:
>
>> Citando Björn Lundin :
>>
>>>  				SEARCH="$2"
>>>  				PORT_LIST=$(port list long_description:$SEARCH | awk {'print  
>>> $1'})	
>>>  				for PORT in $PORT_LIST; do
>>>  					echo -n .
>>>  					port info $PORT
>
>> You should use 'port echo' instead of "port list | awk '{print  
>> $1}'". It
>> should speed things up.
>
> Or, if you're really just going to turn around and call info on it,  
> just use the pseudo-port with info:
>
> 	port info long_description:spreadsheet

Thank you, everyone, for your improvements.

To match the output of "port search" I might choose this final  
implementation, which is quite small and fast:


port() {
	case "$1" in
		searchlong)
			if [ -z "$2" ]; then
				echo "usage: port searchlong <regex>" 1>&2
			else
				port search "long_description:$2"
			fi
			;;
		*)
			/opt/local/bin/port "$@"
			;;
	esac
}


But, at this point it's just a matter of taste whether you'd rather run

$ port search long_description:something

(which works out of the box) or

$ port searchlong something

(which needs the above script in your ~/.bash_profile or similar).

I guess, like Paul said, it comes down to not knowing what "port" is  
already capable of. I sure couldn't figure it out either.





More information about the macports-users mailing list