#!/bin/sh
set -e
echo '[i] this is a git-stub'

usage(){
  echo 'usage: git clone <codeberg.org/xrsh/xrsh> <branchname_or_commithash>'; 
  exit 0;
}

test -n "$1" || usage 

clone(){
  test -n "$2" || usage
  name=$(basename $1)
  branch=$2
  dir="$name/$branch"

  test -n "$DEBUG" && set -x
  wget $1/archive/$branch.zip -O "${name}.zip"
  unzip ${name}.zip
  rm ${name}.zip
  set +x
  echo ""
  echo "[i] unzipped repository to directory '$name'"
}

"$@"