#!/bin/sh

set -eu

if [ "$#" -eq 0 ]; then
  exit 0
elif expr "X$1" : 'X.^(https://|git@)github(\.[[:alpha:]]+)+[/:][^/[:space:]]+/[^/[:space:]]+(/|\.git)?$' >/dev/null; then
  git clone "$1"
elif command -v curl >/dev/null 2>&1; then
  curl -ORLk "$1"
elif command -v wget >/dev/null 2>&1; then
  wget --no-check-certificate --user-agent=download "$1"
fi
shift
$0 "$@"
