summaryrefslogtreecommitdiffstats
path: root/main.sh
diff options
context:
space:
mode:
authorMalf Furious <m@lfurio.us>2017-09-05 02:22:58 -0400
committerMalf Furious <m@lfurio.us>2017-09-05 02:22:58 -0400
commit41c27c4433691fd03270c9b2fc74b073034358ca (patch)
tree06f8e0f416f454a6ef54464819aa021366894e8d /main.sh
parent137e02f57becc7086ebbd9ba38ec0e31143dcf8a (diff)
downloadsystrunk-41c27c4433691fd03270c9b2fc74b073034358ca.tar.gz
systrunk-41c27c4433691fd03270c9b2fc74b073034358ca.zip
Rewrite main mod
Reflect recent changes in the main function
Diffstat (limited to 'main.sh')
-rw-r--r--main.sh30
1 files changed, 18 insertions, 12 deletions
diff --git a/main.sh b/main.sh
index 957cc24..a23a989 100644
--- a/main.sh
+++ b/main.sh
@@ -9,37 +9,43 @@
function main
{
if [ $# -eq 0 ]; then
- echo "Error: no command given"
- exit
+ echo "Fatal: no command given" >&2
+ exit 1
fi
cmd="$1"
shift
- if [ $# -gt 1 ]; then
+ if [ ! -f ".systr/BASE" ]; then
if [[ "$cmd" == "checkout" ]]; then
systr_checkout "$@"
exit
fi
fi
- read remote <.systr/remote
- read path <.systr/path
- read BASE <.systr/BASE
- read TRAC <.systr/TRAC
+ read path <.systr/path || echo "Fatal: not in a worktree" >&2
+ read BASE <.systr/BASE || exit 1
+ read TRAC <.systr/TRAC
+ read MERG <.systr/MERG
+ read updated <.systr/updated
- if [[ "$cmd" == "checkout" ]]; then
- systr_checkout "$@"
- elif [[ "$cmd" == "status" ]]; then
+ if [[ "$cmd" == "status" ]]; then
systr_status "$@"
+ elif [[ "$cmd" == "init" ]]; then
+ systr_init "$@"
+ elif [[ "$cmd" == "checkout" ]]; then
+ systr_checkout "$@"
elif [[ "$cmd" == "commit" ]]; then
systr_commit "$@"
elif [[ "$cmd" == "tag" ]]; then
systr_repo_tag "$@"
+ elif [[ "$cmd" == "shortlog" ]]; then
+ systr_short_log "$@"
elif [[ "$cmd" == "log" ]]; then
- systr_repo_generate_log "$@"
+ systr_log "$@"
else
- echo "Fatal: $cmd not recognized"
+ echo "Fatal: $cmd not recognized" >&2
+ exit 1
fi
}