36 lines
851 B
Plaintext
36 lines
851 B
Plaintext
|
#!/usr/bin/env bash
|
||
|
|
||
|
# This script is a helpful utility for developing fej inside Docker.
|
||
|
|
||
|
# Default values
|
||
|
image="chewingbever/fej"
|
||
|
mode="dev" # Should be either 'rel' or 'dev'
|
||
|
action=""
|
||
|
attach="--detach"
|
||
|
cmd="b"
|
||
|
bin="server"
|
||
|
|
||
|
# Calculated variables
|
||
|
patch_version=`grep -Po '(?<=version = ").*(?=")' Cargo.toml | head -n1`
|
||
|
major_version=`echo "$patch_version" | sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+)/\1/'`
|
||
|
minor_version=`echo "$patch_version" | sed -E 's/([0-9]+).([0-9]+).([0-9]+)/\1.\2/'`
|
||
|
branch=`git rev-parse --abbrev-ref HEAD`
|
||
|
|
||
|
|
||
|
|
||
|
function main() {
|
||
|
# Parse the flags
|
||
|
while getopts ":i:m:a:l" c; do
|
||
|
case $c in
|
||
|
i ) image="$OPTARG" ;;
|
||
|
m ) mode="$OPTARG" ;;
|
||
|
a ) action="$OPTARG" ;;
|
||
|
l ) attach="" ;;
|
||
|
? ) exit 1 ;;
|
||
|
esac
|
||
|
done
|
||
|
shift $((OPTIND-1))
|
||
|
}
|
||
|
|
||
|
main "$@"
|