Explorar o código

Add easy checkout function

Tom McKenzie %!s(int64=2) %!d(string=hai) anos
pai
achega
04161bccae
Modificáronse 1 ficheiros con 12 adicións e 0 borrados
  1. 12 0
      .rc.d/aliases.sh

+ 12 - 0
.rc.d/aliases.sh

@@ -67,3 +67,15 @@ dtach-job() {
 
 # better watch
 alias watchx="watch -cd -n 2"
+
+# easy checkout
+checkout() {
+  if [ -z "$*" ]; then
+    echo "Needs arg"
+    return
+  fi
+
+  DIR=$(echo "$@" | grep -Eo '[^/]+/[^/]+\.git' | sed 's/\.git$//');
+  git clone "$@" "$HOME/repos/$DIR" || return
+  cd "$HOME/repos/$DIR" || return
+}