add initial clone script

This commit is contained in:
Solomon Laing 2023-03-01 08:16:35 +10:30
parent 61f0e55271
commit be95574e99
2 changed files with 26 additions and 0 deletions

View File

@ -59,6 +59,8 @@ export MOZ_USE_XINPUT2="1" # Mozilla smooth scrolling/touchpads.
export AWT_TOOLKIT="MToolkit wmname LG3D" #May have to install wmname
export _JAVA_AWT_WM_NONREPARENTING=1 # Fix for Java applications in dwm
export ZK_NOTEBOOK_DIR="$HOME/notes/zk"
export REPOS="$HOME/repos"
export GITUSER="inkletblot"
# This is something luke smith has in his profile (which I have stolen, it's nice but

24
.local/bin/clone Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
repo="$1" user
repo="${repo#https://github.com
repo="${repo#git@github.com:}"
if [[ $repo =~ / ]]; then
user="${repo%%/*}"
else
user="$GITUSER"
[[ -z "$user" ]] && user="$USER"
fi
name="${repo##*/}"
userd="$REPOS/github.com/$user"
path="$userd/$name"
[[ -d "$path" ]] && cd "$path" && return
mkdir -p "$userd"
cd "$userd"
echo gh repo clone "$user/$name" -- --recurse-submodule
gh repo clone "$user/$name" -- --recurse-submodule
cd "$name"