summaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
authorJake Scott <scottj@sou.edu>2020-11-22 11:16:09 -0800
committerJake Scott <scottj@sou.edu>2020-11-22 11:16:09 -0800
commitdef41d86ed5c0007681a709e0dfcf08807d58881 (patch)
tree16884f183481ebfab0e88056c7e0ec462972f8a5 /init
parent7302876b2a26eb4f8569e2280228831fc8f35b4b (diff)
added ls and init commands
Diffstat (limited to 'init')
-rwxr-xr-xinit25
1 files changed, 25 insertions, 0 deletions
diff --git a/init b/init
new file mode 100755
index 0000000..da5243b
--- /dev/null
+++ b/init
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+if [ $# -ne 1 ]; then
+ echo "usage: init <name>"
+ exit 1
+fi
+
+base_dir="$HOME"
+new_repo="$1"
+
+case $new_repo in
+ *\.git)
+ ;;
+ *)
+ new_repo="${new_repo}.git"
+ ;;
+esac
+
+if [ -d "$new_repo" ]; then
+ echo "$new_repo already exists"
+ exit 1
+fi
+
+mkdir "$base_dir/$new_repo"
+git init --bare "$base_dir/$new_repo"