Added new ! command (magit-shell-command)

This gives users an easy way to interface with external tools like
"topgit".  You type !, followed by "tg create t/foo", and then
everything including magit refreshing the buffer gets handled
automatically.
This commit is contained in:
John Wiegley 2009-03-05 21:49:30 -04:00
parent 417dd46093
commit b45e638154

View file

@ -1104,6 +1104,7 @@ Many Magit faces inherit from this one by default."
(define-key map (kbd "x") 'magit-reset-head)
(define-key map (kbd "X") 'magit-reset-working-tree)
(define-key map (kbd "k") 'magit-discard-item)
(define-key map (kbd "!") 'magit-shell-command)
(define-key map (kbd "RET") 'magit-visit-item)
(define-key map (kbd "SPC") 'magit-show-item-or-scroll-up)
(define-key map (kbd "DEL") 'magit-show-item-or-scroll-down)
@ -2158,6 +2159,15 @@ in log buffer."
(interactive)
(magit-run-git-async "pull" "-v"))
(defun magit-shell-command (command)
(interactive "sCommand: ")
(require 'pcomplete)
(let ((args (car (with-temp-buffer
(insert command)
(pcomplete-parse-buffer-arguments))))
(magit-process-popup-time 0))
(magit-run* args nil nil nil t)))
(defun magit-read-remote (prompt def)
(completing-read (if def
(format "%s (default %s): " prompt def)