aboutsummaryrefslogtreecommitdiff
path: root/bin/project-open
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-08-10 14:04:29 +0200
committerCharles Cabergs <me@cacharle.xyz>2020-08-10 14:04:29 +0200
commit7e1ae8bf92d08665a647422071e6d92a4aca3456 (patch)
treec6278ad782a5fa7d1de31566e8b4a75e9faf6189 /bin/project-open
parent1b1369ce79dcb6e1dcb8ba1bc21cf22220ef52fe (diff)
parent5f97842b01d98c586d3b6bc0834ec6704a2b1d3a (diff)
downloaddotfiles-7e1ae8bf92d08665a647422071e6d92a4aca3456.tar.gz
dotfiles-7e1ae8bf92d08665a647422071e6d92a4aca3456.tar.bz2
dotfiles-7e1ae8bf92d08665a647422071e6d92a4aca3456.zip
Merge branch 'carbon'
Diffstat (limited to 'bin/project-open')
-rwxr-xr-xbin/project-open27
1 files changed, 19 insertions, 8 deletions
diff --git a/bin/project-open b/bin/project-open
index a4bf523..0dd5d31 100755
--- a/bin/project-open
+++ b/bin/project-open
@@ -10,22 +10,33 @@ dest=$(
[ -z "$dest" ] && exit 1
-if cd "$HOME/git/$dest" 2> /dev/null
+dest_path="$HOME/git/$dest"
+
+if cd "$dest_path" 2> /dev/null
then
- touch "$HOME/git/$dest"
+ touch "$dest_path"
st
else
while [ -z "$choice" ]
do
- choice=$(printf 'yes\nno\n' | dmenu -p "Create a repository at ~/git/$dest?")
+ choice=$(printf 'create\nclone\ncancel' | dmenu -p "New repository at ~/git/$dest?")
done
case "$choice" in
- "no") exit ;;
- "yes") mkdir -p "$HOME/git/$dest" ;;
- *) exit 1 ;;
+ "create")
+ mkdir -p "$dest_path"
+ cd "$dest_path" || exit 1
+ git init
+ ;;
+ "clone")
+ url="$(echo '' | dmenu -p "Entry repository url: ")"
+ notify-send "Cloning $url to $dest_path"
+ git clone --recursive "$url" "$dest_path" ||
+ (notify-send -u critical "Clone failed"; exit 1)
+ cd "$dest_path" || exit 1
+ ;;
+ "cancel") exit ;;
+ *) exit 1 ;;
esac
- cd "$HOME/git/$dest" || exit 1
- git init
st
fi