bin/prey
#!/bin/bash
PATH="$PATH:/usr/local/bin"
dir="$(dirname $0)"
[ -x "$dir/node" ] && node="$dir/node" || node="$(command -v node || command -v nodejs)"
# if current file is a symlink (e.g. installed via npm) we'll append
# the relative path to where the package is actually installed.
if [ -n "$(readlink $0 2> /dev/null)" ]; then
rel="$(dirname $(readlink $0))"
dir="$dir/$rel"
fi
script="lib/agent/cli.js"
if [ "$1" = "config" ]; then
script="lib/conf/cli.js"
elif [ "$1" = "test" ]; then
script="node_modules/.bin/_mocha"
fi
exec "$node" "$dir/../${script}" "$@"