]> git.cworth.org Git - nogit/blob - nogit
Add a nogit command-line utility
[nogit] / nogit
1 #!/bin/bash
2
3 usage_brief()
4 {
5     echo "Usage: nogit <command>"
6     echo ""
7     echo "Available commands are:"
8     echo ""
9     echo "    nogit clone"
10     echo "    nogit sync"
11     echo ""
12     echo "See 'nogit help' for more details"
13 }
14
15 usage()
16 {
17     echo "Usage: nogit <command>"
18     echo ""
19     echo "Possible commands are described below:"
20     echo ""
21     echo "nogit clone <command>"
22     echo ""
23     echo "    Clone a nogit repository into the current directory."
24     echo "    This differs from 'git clone' in that it will not create"
25     echo "    a new top-level directory but will instead clone the"
26     echo "    resulting files into the current directory (which may"
27     echo "    already be a local git repository). The object store for"
28     echo "    this newly-cloned repository will be a directory named"
29     echo "    .nogit rather than .git."
30     echo ""
31     echo "    The repository to be cloned should be a nogit repository"
32     echo "    in the sense that its files are intended to be managed"
33     echo "    according to nogit semantics. But other than that, the"
34     echo "    repository to be cloned is an actual git repository."
35     echo ""
36     echo "nogit sync"
37     echo ""
38     echo "    Synchronize local and remote changes"
39     echo ""
40     echo "    For all files managed by a previously-cloned nogit repository"
41     echo "    this command will:"
42     echo ""
43     echo "        * Commit local changes (auto-generated commit message)"
44     echo ""
45     echo "        * Pull down any new commits from the remote"
46     echo ""
47     echo "        * Auto-merge local and remote (keeping both sides and"
48     echo "          with an auto-generated commit message)"
49     echo ""
50     echo "        * Push out any new commits generated locally"
51 }
52
53 nogit_clone()
54 {
55     echo "Internal error: 'nogit clone' not yet implemented"
56 }
57
58 nogit_sync()
59 {
60     echo "Internal error: 'nogit sync' not yet implemented"
61 }
62
63 if [ $# -lt 1 ]; then
64     echo "Error: missing command name." >&2
65     echo ""
66     usage_brief >&2
67     exit 1
68 fi
69
70 cmd="$1"
71
72 case "$cmd" in
73     clone)
74         nogit_clone
75     ;;
76     sync)
77         nogit_sync
78     ;;
79     help)
80         usage
81         exit 0
82     ;;
83     *)
84         echo "Error: Unknown command: $cmd" >&2
85         echo ""
86         usage_brief >&2
87         exit 1
88         ;;
89 esac