diff options
author | Jake Scott <scottj@sou.edu> | 2020-11-22 11:16:09 -0800 |
---|---|---|
committer | Jake Scott <scottj@sou.edu> | 2020-11-22 11:16:09 -0800 |
commit | def41d86ed5c0007681a709e0dfcf08807d58881 (patch) | |
tree | 16884f183481ebfab0e88056c7e0ec462972f8a5 | |
parent | 7302876b2a26eb4f8569e2280228831fc8f35b4b (diff) |
added ls and init commands
-rw-r--r-- | README.md | 7 | ||||
-rwxr-xr-x | init | 25 | ||||
-rwxr-xr-x | ls | 3 |
3 files changed, 35 insertions, 0 deletions
@@ -1 +1,8 @@ # git-shell commands + +Required functionality: + +help - usage messages +ls - list all repositories +init - create a new repository +rm - remove a repository @@ -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" @@ -0,0 +1,3 @@ +#!/bin/sh + +ls -1 *\.git | cut -d. -f1 |