-
-
Save rgm/4d7dbd42fe95d5d4560ec288ddce172b to your computer and use it in GitHub Desktop.
helper for overmind
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# travel upwards to find the nearest `.overmind.sock` so you can issue | |
# eg `ov r` or `ov c` from any subdir in a project, instead of having to | |
# cd up to where the Procfile is. | |
set -e | |
dnif () { | |
# https://stackoverflow.com/a/24642735 | |
# Recursively list a file from PWD up the directory tree to root | |
local THERE=$PWD RC=2 | |
while [[ $THERE != / ]] | |
do [[ -e $THERE/${2:-$1} ]] && { ls ${2:+$1} $THERE/${2:-$1}; RC=0; } | |
THERE=$(dirname $THERE) | |
done | |
[[ -e $THERE/${2:-$1} ]] && { ls ${2:+$1} /${2:-$1}; RC=0; } | |
return $RC | |
} | |
sock=$(dnif ".overmind.sock") | |
set -x | |
overmind $1 $2 -s $sock |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment