From 22e9dcceaf9ce028649d70038b8e702aea571a40 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Thu, 15 Apr 2021 22:46:23 +0200 Subject: [PATCH] [#26] Started writing fejctl --- fejctl | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 fejctl 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 "$@"