diff --git a/fejctl b/fejctl new file mode 100755 index 0000000..8f3eb74 --- /dev/null +++ b/fejctl @@ -0,0 +1,35 @@ +#!/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 "$@"