 	"This is an alist that is created based on the current
 	`boop-config-alist` to keep the results synchronized when
 	performing asynchronous actions")
-
-(defvar boop-info nil
-	"A variable to store the info produced by running the plugin scripts")
 
 (defvar boop-timer nil
 	"The value associated with the starting the boop timer so that

	"The default directory to read plugins from.")

(defvar boop-config-alist nil
	"An alist of scripts and the arguments to run them with.")

(setq boop-config-alist
      '((service-fuji jenkins "jenkins.connected-tv.tools.bbc.co.uk" "service-fuji")

            ((string-equal (cdr info) boop-failure) (boop--failure (format "%s" (car info))))
            (t (boop--warning (format "%s" (car info)))))) boop-info-alist ""))

(defun boop-sync-info-and-config ()
  "Synchronizes the info alist so that it only contains items in the config alist."
  (setq boop-info-alist (--filter (assoc (car it) boop-config-alist) boop-info-alist)))

(defun boop-handle-update-result (id result)
  "Handle the result of the async `shell-command-to-string`"
  (if (assoc id boop-info-alist)
      (setf (cdr (assoc id boop-info-alist)) result)
    (setq boop-info-alist (append (list (cons id result)) boop-info-alist))))

(defun boop-update-info ()
  "Execute all of the plugins and return a list of the results."
	(let* ((plugins (boop--get-plugin-alist)))
    (boop-sync-info-and-config)
	  (-map (lambda (config)
            (let* ((id (car config))
                   (script (cdr (assoc (cadr config) plugins)))
                   (args (mapconcat 'identity (cddr config) " "))
                   (cmd (format "%s %s" script args)))
              (async-start `(lambda () (shell-command-to-string ,cmd))
                           `(lambda (result) (boop-handle-update-result (quote ,id) (s-trim result))))))
          boop-config-alist)))

;; Interactive Functions
