Revision: 37241 http://trac.macosforge.org/projects/macports/changeset/37241 Author: raimue@macports.org Date: 2008-05-31 13:36:51 -0700 (Sat, 31 May 2008) Log Message: ----------- port/port.tcl: Do some half-intelligent string matching for port search. If the specified search string already contained an *, use it as direct glob expression, otherwise add * around the search string. As an example see how the output from 'port search less' and 'port search less*' differs. Modified Paths: -------------- trunk/base/src/port/port.tcl Modified: trunk/base/src/port/port.tcl =================================================================== --- trunk/base/src/port/port.tcl 2008-05-31 20:20:27 UTC (rev 37240) +++ trunk/base/src/port/port.tcl 2008-05-31 20:36:51 UTC (rev 37241) @@ -1959,9 +1959,15 @@ foreach portname $portlist { puts -nonewline $separator + if {[string first "*" $portname] == -1} { + set searchstring "*$portname*" + } else { + set searchstring $portname + } + set portfound 0 set res {} - if {[catch {set matches [mportsearch "*$portname*" no glob name]} result]} { + if {[catch {set matches [mportsearch $searchstring no glob name]} result]} { global errorInfo ui_debug "$errorInfo" break_softcontinue "search for name $portname failed: $result" 1 status @@ -1971,7 +1977,7 @@ add_to_portlist tmp [concat [list name $name] $info] } set res [opUnion $res $tmp] - if {[catch {set matches [mportsearch "*$portname*" no glob description]} result]} { + if {[catch {set matches [mportsearch $searchstring no glob description]} result]} { global errorInfo ui_debug "$errorInfo" break_softcontinue "search for description $portname failed: $result" 1 status @@ -1981,7 +1987,7 @@ add_to_portlist tmp [concat [list name $name] $info] } set res [opUnion $res $tmp] - if {[catch {set matches [mportsearch "*$portname*" no glob long_description]} result]} { + if {[catch {set matches [mportsearch $searchstring no glob long_description]} result]} { global errorInfo ui_debug "$errorInfo" break_softcontinue "search for long_description $portname failed: $result" 1 status
participants (1)
-
raimue@macports.org