diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2020-08-10 02:50:57 +0200 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2020-08-10 02:50:57 +0200 |
| commit | c9a38b22e7b5ea507352a170fd4cf3ea73acc2cd (patch) | |
| tree | 2e53a8a0c152018c31abd89f59afd2583e8d9d33 /bin/project-open | |
| parent | b886c364aca56c684d91a2e6e9c823a50c8b692f (diff) | |
| download | dotfiles-c9a38b22e7b5ea507352a170fd4cf3ea73acc2cd.tar.gz dotfiles-c9a38b22e7b5ea507352a170fd4cf3ea73acc2cd.tar.bz2 dotfiles-c9a38b22e7b5ea507352a170fd4cf3ea73acc2cd.zip | |
Added repo clone in project-open, cleaning installation script
Diffstat (limited to 'bin/project-open')
| -rwxr-xr-x | bin/project-open | 27 |
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 |
