#!/usr/bin/env bash

# Exit if no argument has been provided
[[ -z "$1" ]] && exit 1

# Variables
url="$1"
name="${url/*\/}"

# Exit if no name exists or the url and name variables are the same
[[ -z "$name" || "$url" = "$name" ]] && exit 1

# Add the submodule
git submodule add "$url" "vim/bundle/$name" || exit 1

# Initialize the submodule
git submodule update --init --recursive