eris/eris-docker
Andrew Hamilton 787c304d06 Files don't need individual license headers.
- All files are licensed by the LICENSE file at root.
- Updated the license to 2021.
- Have kept the license in LS_COLORS since its 3rd party.
2021-04-12 02:25:49 +10:00

23 lines
705 B
Bash
Executable file

#!/bin/bash
set -e
DOCKER_IMAGE=eris
ARGS=( $(getopt -u -o hiw:e:t:c: --long help,info,workers:,editor:,theme:,compression: -- "$@") )
if [ "${ARGS[-1]}" == "--" ]; then
OPTION_ARGS="${ARGS[@]:0:${#ARGS[@]}-1}" # ARGS[:-1]
DOCKER_ARGS="$DOCKER_IMAGE $OPTION_ARGS"
elif [ "${ARGS[-2]}" == "--" ]; then
OPTION_ARGS="${ARGS[@]:0:${#ARGS[@]}-2}" # ARGS[:-2]
REAL_PATH=$(realpath "${ARGS[-1]}")
PROJECT=$(basename "$REAL_PATH")
DOCKER_ARGS="-v $REAL_PATH:/tmp/$PROJECT $DOCKER_IMAGE $OPTION_ARGS /tmp/$PROJECT"
else
echo "Usage:
eris [options] <directory>
eris -h | --help"
exit 1
fi
exec docker run -v /etc/passwd:/etc/passwd -u ${UID}:$(id -g) -it --rm $DOCKER_ARGS