comparison bin/artisan @ 594:2ac0fa5ba73c

Add artisan convenience script
author nanaya <me@myconan.net>
date Wed, 02 Nov 2016 04:03:09 +0900
parents
children cd80bafc1257
comparison
equal deleted inserted replaced
591:23e326f74bfd 594:2ac0fa5ba73c
1 #!/bin/sh
2 # License: MIT (nanaya <me@myconan.net>)
3 # starts up artisan wherever
4
5 set -e
6 set -u
7
8 _artisan_path="$(basename "${0}")"
9 if [ ! -f "${_artisan_path}" ]; then
10 _git_root="$(git rev-parse --show-toplevel 2> /dev/null || true)"
11 _hg_root="$(hg root 2> /dev/null || true)"
12
13 for i in "${_git_root}" "${_hg_root}"; do
14 [ "${i}" = "" ] && continue
15 _new_artisan_path="${i}/${_artisan_path}"
16 if [ -f "${_new_artisan_path}" ]; then
17 _artisan_path="${_new_artisan_path}"
18 break
19 fi
20 done
21 fi
22
23 exec php "${_artisan_path}" "${@}"