       (set-process-sentinel proc #'dwim-shell-command--sentinel)
       (set-process-filter proc #'dwim-shell-command--filter))))
 
-(defun dwim-shell-command--expand (template file &optional post-process-template)
+(defun dwim-shell-command--expand (template file &optional post-process-template temp-dir)
   "Expand TEMPLATE using FILE.
 
 Expand using <<f>> for FILE, <<fne>> for FILE without extension, and

    (setq shell-args (list shell-args)))
  (when (stringp utils)
    (setq utils (list utils)))
  (let* ((proc-buffer (generate-new-buffer buffer-name))
         (template script)
         (script "")


  ;; "<<f>>" with "/path/file.jpg" -> "/path/file.jpg"
  (setq template (replace-regexp-in-string "\\(\<\<f\>\>\\)" file template nil nil 1))

  ;; "<<td>>" with TEMP-DIR -> "/var/folders/m7/ky091cp56d5g68nyhl4y7frc0000gn/T/dwim-shell-command-JNK4V5"
  (setq template (replace-regexp-in-string "\\(\<\<td\>\>\\)" temp-dir template nil nil 1))

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