Sha256: 0b6e19b370ff151f0dfdbee4fcd5d336e0b304156a25d93998f1822ea521aa53

Contents?: true

Size: 639 Bytes

Versions: 4

Compression:

Stored size: 639 Bytes

Contents

#!/usr/bin/env bash
#
#/ Usage: foreman-runner [-d <dir>] [-p] <command> [<args>...]
#/
#/ Run a command with exec, optionally changing directory first

set -e

error() {
  echo $@ >&2
  exit 1
}

usage() {
  cat $0 | grep '^#/' | cut -c4-
  exit
}

read_profile=""

while getopts ":hd:p" OPT; do
  case $OPT in
     d) cd "$OPTARG" ;;
     p) read_profile="1" ;;
     h) usage ;;
    \?) error "invalid option: -$OPTARG" ;;
     :) error "option -$OPTARG requires an argument" ;;
  esac
done

shift $((OPTIND-1))

[ -z "$1" ] && usage

if [ "$read_profile" == "1" ]; then
  if [ -f .profile ]; then
    source .profile
  fi
fi

exec "$@"

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
foreman-0.58.0 bin/foreman-runner
foreman-0.57.0-java bin/foreman-runner
foreman-0.57.0 bin/foreman-runner
foreman-0.56.0 bin/foreman-runner