   (cl-assert (equal major-mode 'dired-mode) nil "Not in dired-mode")
   (dwim-shell-execute-script script name (dired-get-marked-files) utils
                              post-process-template on-completion))
-
-(defun dwim-shell--dired-files ()
-  "List of files in current dired buffer."
-  (cl-assert (equal major-mode 'dired-mode) nil "Not in dired-mode")
-  (save-excursion
-    (goto-char (point-min))
-    (let (r)
-      (while (= 0 (forward-line))
-        (when-let (filename (dired-get-filename nil t))
-          (push filename r)))
-      (nreverse r))))
 
 (defun dwim-shell-execute-script (script name files utils &optional post-process-template on-completion)
   "Execute SCRIPT, using buffer NAME, FILES, and bin UTILS."

                          (dwim-shell--exec-reporter exec)
                          (dwim-shell--exec-on-completion exec))))

(provide 'dwim-shell)

    (setq template (funcall post-process-template template file)))
  template)

(defun dwim-shell--default-directory ()
  "List of files in current buffer's `default-directory'."
  (cond ((equal major-mode 'dired-mode)
         (dwim-shell--dired-files))
        (default-directory
