 ;;; Commentary:
 ;; Provides utilities to install harmsway.
 ;;
+(require 's)
+
+(defvar harmsway-install-cmd-alist '("install-world.sh")
+  "List of commands to be invoked to install harmsway.")
+
+(defvar harmsway-install--last-cmd nil "Last command run.")
 
 ;;; Code:
 ;;;###autoload
 (defun harmsway/install-world ()
   "Install the harmsway world."
   (interactive)
-  (let* ((buf (get-buffer-create " *Install-World*"))
+  (let* ((cmd (cond ((eq (length harmsway-install-cmd-alist) 1)
+                     (car harmsway-install-cmd-alist))
+                    (t (completing-read "Command: " harmsway-install-cmd-alist))))
+         (bufname (concat " *" (s-upcase (file-name-base cmd)) "*"))
+         (buf (get-buffer-create bufname))
          proc)
-    (setq proc (start-process "install-world" buf
-                              "sh" "-c" "install-world.sh"))
+    (setq harmsway-install--last-cmd cmd)
+    (setq proc (start-process cmd buf
+                              "bash" "--rcfile" "~/.bashrc" "-ci"
+                              cmd))
     (with-current-buffer (pop-to-buffer buf)
       (read-only-mode 1))
     (set-process-sentinel proc #'harmsway/install-world-sentinel)))

;; Author: Dan Harms <enniomore@icloud.com>
;; Created: Wednesday, November 22, 2017
;; Version: 1.0
;; Modified Time-stamp: <2017-11-22 17:20:49 dharms>
;; Modified by: Dan Harms
;; Keywords: tools


(defun harmsway/install-world-sentinel (proc change)
  "A process sentinel to track the state of PROC, via CHANGE."
  (when (string-match-p "\\(finished\\|exited\\)" change)
    (message "%s finished." harmsway-install--last-cmd)))

(provide 'install-world)
;;; install-world.el ends here
