 
 (defun ivy-spacemacs-help//help-action (args)
   "Open the file `packages.el' and go to the init function."
-  (if (null (cadr args))
+  (if (null (caddr args))
       (message "There are no packages associated with this layer.")
-    (let* ((layer-str (car args))
+    (let* ((layer-str (cadr args))
            (layer-sym (intern layer-str))
-           (package-str (cadr args))
+           (package-str (caddr args))
            (path (file-name-as-directory
                   (concat (ht-get configuration-layer-paths layer-sym)
                           layer-str)))


(defun ivy-spacemacs-help//layer-action-open-packages (candidate)
  "Open the `packages.el' file of the passed CANDIDATE."
  (ivy-spacemacs-help//layer-action-open-file "packages.el" candidate))

;;;###autoload
(defun ivy-spacemacs-help-layers ()


(defun ivy-spacemacs-help//layer-action-add-layer (candidate)
  "Adds layer to dotspacemacs file and reloads configuration"
  (if (configuration-layer/layer-usedp (intern (cdr candidate)))
      (message "Layer already added.")
    (let ((dotspacemacs   (find-file-noselect (dotspacemacs/location))))
      (with-current-buffer dotspacemacs
        (beginning-of-buffer)
        (let ((insert-point (re-search-forward
                             "dotspacemacs-configuration-layers *\n?.*\\((\\)")))
          (insert (format "\n%s\n" (cdr candidate)))
          (indent-region insert-point (+ insert-point (length (cdr candidate))))
          (save-current-buffer)))
      (dotspacemacs/sync-configuration-layers))))

(defun ivy-spacemacs-help//layer-action-open-dired (candidate)
  "Open dired at the location of the passed layer CANDIDATE."
  (dired
   (ivy-spacemacs-help//layer-action-get-directory (cdr candidate))))

(defun ivy-spacemacs-help//layer-action-open-readme-edit (candidate)
  "Open the `README.org' file of the passed CANDIDATE for editing."
