aboutsummaryrefslogtreecommitdiff
path: root/bin/project-open
diff options
context:
space:
mode:
Diffstat (limited to 'bin/project-open')
-rwxr-xr-xbin/project-open53
1 files changed, 0 insertions, 53 deletions
diff --git a/bin/project-open b/bin/project-open
deleted file mode 100755
index adb27a4..0000000
--- a/bin/project-open
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/bin/sh
-
-# shellcheck disable=SC2088
-# (tile does not expand in single quote)
-dest=$(
- find ~/git -mindepth 1 -maxdepth 1 -printf '%A@\t%f\n' |
- sort -r |
- cut -f 2 |
- dmenu -l 10 -p '~/git/'
-)
-
-[ -z "$dest" ] && exit 1
-
-dest_path="$HOME/git/$dest"
-
-if cd "$dest_path" 2> /dev/null
-then
- touch "$dest_path"
- exec st
-else
- while [ -z "$choice" ]
- do
- choice=$(printf 'create\nclone\ncancel' | dmenu -p "New repository at ~/git/$dest?")
- done
-
- case "$choice" in
- "create")
- mkdir -p "$dest_path"
- cd "$dest_path" || exit 1
- git init
- exec st
- ;;
-
- "clone")
- while [ -z "$remote_choice" ]
- do
- remote_choice=$(printf 'github.com\ncacharle.xyz\nclipboard\nother' | dmenu -p "Remote location")
- done
- case "$remote_choice" in
- github.com) prefix='git@github.com:cacharle/' ;;
- cacharle.xyz) prefix='git@cacharle.xyz:/srv/git/' ;;
- clipboard) dest="$(xclip -selection clipboard -o)" ;;
- other) ;;
- esac
- url="$prefix$(echo "$dest" | dmenu -p "Enter repository url: $prefix")"
- st -e /bin/sh -c "git clone --recursive '$url' '$dest_path' && cd '$dest_path' && exec $SHELL" ||
- notify-send -u critical "Could not clone $url in $dest_path" && exit 1
- ;;
-
- "cancel") exit ;;
- *) exit 1 ;;
- esac
-fi