Skip to content

Commit

Permalink
Make `magithub-clone' a little prettier and more flexible
Browse files Browse the repository at this point in the history
  • Loading branch information
vermiculus committed Feb 12, 2017
1 parent 58bd5eb commit 8fe2dab
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions magithub.el
Original file line number Diff line number Diff line change
Expand Up @@ -236,16 +236,19 @@ Banned inside existing GitHub repositories if
(let ((args (magithub-clone--get-repo)))
(append args (list (read-directory-name
"Destination: "
magithub-clone-default-directory
(if (s-ends-with? "/" magithub-clone-default-directory)
magithub-clone-default-directory
(concat magithub-clone-default-directory "/"))
nil nil
(cadr args)))))))
(unless (file-writable-p dir)
(user-error "%s does not exist or is not writable" dir))
(when (y-or-n-p (format "Clone %s/%s to %s/%s? " user repo dir repo))
(when (y-or-n-p (format "Clone %s/%s to %s? " user repo dir))
(let* ((proc (start-process "*magithub-clone*" "*magithub-clone*"
magithub-hub-executable
"clone"
(format "%s/%s" user repo)
(expand-file-name repo dir))))
dir)))
(set-process-sentinel
proc
(lambda (p event)
Expand All @@ -258,7 +261,7 @@ Banned inside existing GitHub repositories if
(defun magithub-clone--finished (user repo dir)
"After finishing the clone, allow the user to jump to their new repo."
(when (y-or-n-p (format "%s/%s has finished cloning to %s. Open? " user repo dir))
(magit-status (s-chop-suffix "/" (expand-file-name repo dir)))))
(magit-status (s-chop-suffix "/" dir))))

(defvar magithub-features nil
"An alist of feature-symbols to Booleans.
Expand Down

0 comments on commit 8fe2dab

Please sign in to comment.