]> git.cworth.org Git - nogit/commitdiff
Add a nogit command-line utility
authorCarl Worth <cworth@cworth.org>
Sun, 5 Jul 2020 05:09:21 +0000 (22:09 -0700)
committerCarl Worth <cworth@cworth.org>
Sun, 5 Jul 2020 05:49:39 +0000 (22:49 -0700)
This captures the structure of the two basic commands:

nogit clone <URL>
        nogit sync

Along with "nogit help" for help on the above.

There's no implementation for either command yet. Just the
documentation so far.

nogit [new file with mode: 0755]

diff --git a/nogit b/nogit
new file mode 100755 (executable)
index 0000000..c71b7ab
--- /dev/null
+++ b/nogit
@@ -0,0 +1,89 @@
+#!/bin/bash
+
+usage_brief()
+{
+    echo "Usage: nogit <command>"
+    echo ""
+    echo "Available commands are:"
+    echo ""
+    echo "    nogit clone"
+    echo "    nogit sync"
+    echo ""
+    echo "See 'nogit help' for more details"
+}
+
+usage()
+{
+    echo "Usage: nogit <command>"
+    echo ""
+    echo "Possible commands are described below:"
+    echo ""
+    echo "nogit clone <command>"
+    echo ""
+    echo "    Clone a nogit repository into the current directory."
+    echo "    This differs from 'git clone' in that it will not create"
+    echo "    a new top-level directory but will instead clone the"
+    echo "    resulting files into the current directory (which may"
+    echo "    already be a local git repository). The object store for"
+    echo "    this newly-cloned repository will be a directory named"
+    echo "    .nogit rather than .git."
+    echo ""
+    echo "    The repository to be cloned should be a nogit repository"
+    echo "    in the sense that its files are intended to be managed"
+    echo "    according to nogit semantics. But other than that, the"
+    echo "    repository to be cloned is an actual git repository."
+    echo ""
+    echo "nogit sync"
+    echo ""
+    echo "    Synchronize local and remote changes"
+    echo ""
+    echo "    For all files managed by a previously-cloned nogit repository"
+    echo "    this command will:"
+    echo ""
+    echo "        * Commit local changes (auto-generated commit message)"
+    echo ""
+    echo "        * Pull down any new commits from the remote"
+    echo ""
+    echo "        * Auto-merge local and remote (keeping both sides and"
+    echo "          with an auto-generated commit message)"
+    echo ""
+    echo "        * Push out any new commits generated locally"
+}
+
+nogit_clone()
+{
+    echo "Internal error: 'nogit clone' not yet implemented"
+}
+
+nogit_sync()
+{
+    echo "Internal error: 'nogit sync' not yet implemented"
+}
+
+if [ $# -lt 1 ]; then
+    echo "Error: missing command name." >&2
+    echo ""
+    usage_brief >&2
+    exit 1
+fi
+
+cmd="$1"
+
+case "$cmd" in
+    clone)
+        nogit_clone
+    ;;
+    sync)
+        nogit_sync
+    ;;
+    help)
+        usage
+        exit 0
+    ;;
+    *)
+        echo "Error: Unknown command: $cmd" >&2
+        echo ""
+        usage_brief >&2
+        exit 1
+        ;;
+esac