feat: add possibility to pass options to fd and find

This commit is contained in:
Lucien Cartier-Tilet 2023-07-08 12:21:09 +02:00
parent df13ed9ce3
commit 7c4af643f9
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA

View File

@ -74,6 +74,16 @@ extension, such as
:group 'ivy-quick-find-files :group 'ivy-quick-find-files
:type 'list) :type 'list)
(defcustom ivy-quick-find-files-fd-additional-options ""
"Additional command-line options for fd."
:group 'ivy-quick-find-files
:type 'string)
(defcustom ivy-quick-find-files-find-additional-options ""
"Additional command-line options for find."
:group 'ivy-quick-find-files
:type 'string)
; Internal functions ;;;;;;;;;;;;;;;;;; ; Internal functions ;;;;;;;;;;;;;;;;;;
(defun ivy-quick-find-files--split-lines (str &optional omit-null) (defun ivy-quick-find-files--split-lines (str &optional omit-null)
@ -92,11 +102,15 @@ Return files as a list of absolute paths."
(ivy-quick-find-files--split-lines (ivy-quick-find-files--split-lines
(shell-command-to-string (format (shell-command-to-string (format
(pcase ivy-quick-find-files-program (pcase ivy-quick-find-files-program
('fd "fd . %s -e %s -c never") ('fd "fd . %s -e %s -c never %s")
('find "find %s -name \"*.%s\"") ('find "find %s -name \"*.%s\" %s")
(otherwise (error "Find program %s not implemented" otherwise))) (otherwise (error "Find program %s not implemented" otherwise)))
dir dir
ext)))) ext
(pcase ivy-quick-find-files-program
('fd ivy-quick-find-files-fd-additional-options)
('find ivy-quick-find-files-find-additional-options)
(otherwise (error "Find program %s not implemented" otherwise)))))))
; Public functions ;;;;;;;;;;;;;;;;;;;; ; Public functions ;;;;;;;;;;;;;;;;;;;;