diff options
-rw-r--r-- | main.sh | 30 |
1 files changed, 18 insertions, 12 deletions
@@ -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 } |