bin: add bcoin entry point.

This commit is contained in:
Christopher Jeffrey 2016-08-04 14:10:02 -07:00
parent 3cbc5e2726
commit 79a9749751
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
3 changed files with 44 additions and 1 deletions

42
bin/bcoin Executable file
View File

@ -0,0 +1,42 @@
#!/bin/bash
daemon=0
cli=0
name='node'
# Have to do it this way
# because OSX isn't a real OS
file=$(perl -MCwd -e "print Cwd::realpath('$0')")
dir=$(dirname "$file")
if test x"$1" = x'cli'; then
shift
cli=1
fi
for v in "$@"; do
case "$v" in
--daemon)
daemon=1
;;
--spv)
name='spvnode'
;;
esac
done
if test $cli -eq 1; then
exec "${dir}/bcoin-cli" "$@"
exit 1
fi
if test $daemon -eq 1; then
(
setsid "${dir}/${name}" "$@" > /dev/null 2>& 1 &
echo "$!"
)
exit 0
else
exec "${dir}/${name}" "$@"
exit 1
fi

View File

@ -5,7 +5,8 @@
"main": "./lib/bcoin.js",
"bin": {
"bcoin-node": "./bin/node",
"bcoin-cli": "./bin/bcoin-cli"
"bcoin-cli": "./bin/cli",
"bcoin": "./bin/bcoin"
},
"preferGlobal": false,
"scripts": {