From a3c2400aa991734812fc20616e60b6b8f746204c Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Tue, 5 Sep 2017 03:39:39 -0400 Subject: Fix control flow in main() Enable init to be run from outside worktrees. and also fixed some error messages. --- main.sh | 12 +++++++++--- 1 file 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 -- cgit v1.2.3