Function: projectile--ext-command-line

projectile--ext-command-line is a byte-compiled function defined in projectile.el.

Signature

(projectile--ext-command-line COMMAND PATHSPECS)

Documentation

Return COMMAND with PATHSPECS appended as shell-quoted positional arguments.

PATHSPECS may be nil, in which case COMMAND is returned unchanged. Shared by the synchronous and asynchronous indexing-command runners.

Most indexing tools (git ls-files, find, hg locate, ...) accept trailing path arguments to restrict the listing. fd is the exception: its positional grammar is [pattern] [path...], so a trailing path would be taken as the search pattern, and fd 9+ additionally rejects
--strip-cwd-prefix whenever an explicit path is given (see #2005). So
for fd commands we drop --strip-cwd-prefix (Projectile strips the
./ prefix from the output anyway) and pass the directories via
--search-path, which is unambiguous regardless of whether the command
already carries a search pattern. fd commands are recognised by the
--strip-cwd-prefix flag Projectile puts in its default fd recipes.

Source Code

;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
(defun projectile--ext-command-line (command pathspecs)
  "Return COMMAND with PATHSPECS appended as shell-quoted positional arguments.
PATHSPECS may be nil, in which case COMMAND is returned unchanged.
Shared by the synchronous and asynchronous indexing-command runners.

Most indexing tools (`git ls-files', `find', `hg locate', ...) accept
trailing path arguments to restrict the listing.  `fd' is the exception:
its positional grammar is `[pattern] [path...]', so a trailing path
would be taken as the search pattern, and `fd' 9+ additionally rejects
`--strip-cwd-prefix' whenever an explicit path is given (see #2005).  So
for `fd' commands we drop `--strip-cwd-prefix' (Projectile strips the
`./' prefix from the output anyway) and pass the directories via
`--search-path', which is unambiguous regardless of whether the command
already carries a search pattern.  `fd' commands are recognised by the
`--strip-cwd-prefix' flag Projectile puts in its default `fd' recipes."
  (if (not pathspecs)
      command
    (if (string-match-p "--strip-cwd-prefix\\b" command)
        (concat (projectile--strip-fd-cwd-prefix-flag command) " "
                (mapconcat (lambda (path)
                             (concat "--search-path " (shell-quote-argument path)))
                           pathspecs " "))
      (concat command " "
              (mapconcat #'shell-quote-argument pathspecs " ")))))