Fixed "tomb search" for real

Makes `tomb search` work as expected.
`tomb search tombname pattern` will search `pattern` in `tombname`.
This commit is contained in:
gdrooid 2013-05-31 14:18:20 +03:00
parent 778bca3864
commit d4b5d652f5

9
tomb
View File

@ -1537,10 +1537,11 @@ search_tombs() {
die "Cannot index tombs on this system: updatedb not installed" } die "Cannot index tombs on this system: updatedb not installed" }
# list all open tombs # list all open tombs
mounted_tombs=(`list_tomb_mounts`) mounted_tombs=(`list_tomb_mounts $1`)
{ test ${#mounted_tombs} = 0 } && { { test ${#mounted_tombs} = 0 } && {
die "I can't see any open tomb, may they all rest in peace." } die "I can't see any open tomb, may they all rest in peace." }
yes "Searching for: $fg_bold[white]${=PARAM}$fg_no_bold[white]" shift
yes "Searching for: $fg_bold[white]${=@}$fg_no_bold[white]"
for t in ${mounted_tombs}; do for t in ${mounted_tombs}; do
xxx "checking for index: ${t}" xxx "checking for index: ${t}"
mapper=`basename ${t[(ws:;:)1]}` mapper=`basename ${t[(ws:;:)1]}`
@ -1548,8 +1549,8 @@ search_tombs() {
tombmount=${t[(ws:;:)2]} tombmount=${t[(ws:;:)2]}
if [ -r ${tombmount}/.updatedb ]; then if [ -r ${tombmount}/.updatedb ]; then
say "Searching in tomb $tombname" say "Searching in tomb $tombname"
locate -d ${tombmount}/.updatedb -e -i ${=PARAM} locate -d ${tombmount}/.updatedb -e -i ${=@}
say "Matches found: `locate -d ${tombmount}/.updatedb -e -i -c ${=PARAM}`" say "Matches found: `locate -d ${tombmount}/.updatedb -e -i -c ${=@}`"
else else
no "skipping tomb $tombname: not indexed" no "skipping tomb $tombname: not indexed"
no "run 'tomb index' to create indexes" no "run 'tomb index' to create indexes"