Function: consult--fd-make-builder

consult--fd-make-builder is a byte-compiled function defined in consult.el.

Signature

(consult--fd-make-builder PATHS)

Documentation

Build find command line, finding across PATHS.

Source Code

;; Defined in ~/.emacs.d/elpa/consult-20260805.1130/consult.el
;;;;; Command: consult-fd

(defun consult--fd-make-builder (paths)
  "Build find command line, finding across PATHS."
  (let ((cmd (consult--build-args consult-fd-args)))
    (lambda (input)
      (pcase-let* ((`(,arg . ,opts) (consult--command-split input))
                   (flags (append cmd opts))
                   (ignore-case
                    (and (not (or (member "-s" flags) (member "--case-sensitive" flags)))
                         (or (member "-i" flags) (member "--ignore-case" flags)
                             (let (case-fold-search)
                               ;; Case insensitive if there are no uppercase letters
                               (not (string-match-p "[[:upper:]]" arg)))))))
        (if (or (member "-F" flags) (member "--fixed-strings" flags)
                (member "-g" flags) (member "--glob" flags))
            (when-let* ((args (consult--split-escaped arg)))
              (cons (append cmd opts
                            (mapcan (lambda (x) `("--and" ,x))
                                    (if (or (member "-g" flags) (member "--glob" flags))
                                        (mapcar (lambda (x) (concat "**/" x)) args)
                                      args))
                            (mapcan (lambda (x) `("--search-path" ,x)) paths))
                    (apply-partially #'consult--highlight-literals args ignore-case)))
          (pcase-let ((`(,re . ,hl) (consult--compile-regexp arg 'pcre ignore-case)))
             (when (or re opts) ;; Either option or regexp must be provided
              (cons (append cmd opts
                            (mapcan (lambda (x) `("--and" ,x)) re)
                            (mapcan (lambda (x) `("--search-path" ,x)) paths))
                    hl))))))))