summaryrefslogtreecommitdiffstats
path: root/main.sh
blob: 86fcaff6017b56ed4ff20a149d2eb4ceaf6c3838 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
##
# systrunk <command> [<options>, ...]
#
# A version control system powered by rsync, focused on tracking large
# directory trees with large files, even binary files; system images.
#
# Main function, decide what to do ...
##
function main
{
    if [ $# -eq 0 ]; then
        echo "Error: no command given"
        exit
    fi

    cmd="$1"
    shift

    if [ $# -gt 1 ]; 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

    if [[ "$cmd" == "checkout" ]]; then
        systr_checkout "$@"
    elif [[ "$cmd" == "status" ]]; then
        systr_status "$@"
    elif [[ "$cmd" == "commit" ]]; then
        systr_commit "$@"
    elif [[ "$cmd" == "tag" ]]; then
        systr_repo_tag "$@"
    else
        echo "Fatal: $cmd not recognized"
    fi
}

main "$@"