#!/bin/sh
# A small script to help recoll start info on the node corresponding to 
# the result document. The title is the node path, but it needs to be
# somewhat processed

fatal()
{
    echo $*
    exit 1
}
Usage()
{
    fatal "Usage: rclshowinfo filename top node / sub node [/ ...]"
}

test $# -ge 2 || Usage
filename=`echo $1 | sed -e 's!^file://!!'`
shift

# The title set by recoll while indexing is like:
# infofilename / first node path element / second node path element ...
IFS=/
set $*
while test $# -gt 1;do
  shift
# node=`echo $1 | sed -e 's/^ *//' -e 's/ *$//'`
  node=`eval "echo $1"`
  nodepath="$nodepath '$node'"
done

set -x
exec xterm -e "info -f $filename $nodepath"
