summaryrefslogtreecommitdiffstats
path: root/main.sh
diff options
context:
space:
mode:
authorMalf Furious <m@lfurio.us>2017-09-05 03:39:39 -0400
committerMalf Furious <m@lfurio.us>2017-09-05 03:39:39 -0400
commita3c2400aa991734812fc20616e60b6b8f746204c (patch)
tree78d3b414cc2e32ee3e92f7fdd4fed65fc53d59cd /main.sh
parentfee8fe8f2f3969031ac6deb547763619f5b5710a (diff)
downloadsystrunk-a3c2400aa991734812fc20616e60b6b8f746204c.tar.gz
systrunk-a3c2400aa991734812fc20616e60b6b8f746204c.zip
Fix control flow in main()
Enable init to be run from outside worktrees. and also fixed some error messages.
Diffstat (limited to 'main.sh')
-rw-r--r--main.sh12
1 files changed, 9 insertions, 3 deletions
diff --git a/main.sh b/main.sh
index a23a989..0c3d3df 100644
--- a/main.sh
+++ b/main.sh
@@ -19,12 +19,18 @@ function main
if [ ! -f ".systr/BASE" ]; then
if [[ "$cmd" == "checkout" ]]; then
systr_checkout "$@"
- exit
+ elif [[ "$cmd" == "init" ]]; then
+ systr_init "$@"
+ else
+ echo "Fatal: not in a worktree" >&2
+ exit 1
fi
+
+ exit
fi
- read path <.systr/path || echo "Fatal: not in a worktree" >&2
- read BASE <.systr/BASE || exit 1
+ read path <.systr/path
+ read BASE <.systr/BASE
read TRAC <.systr/TRAC
read MERG <.systr/MERG
read updated <.systr/updated