Function: consult--command-split
consult--command-split is a byte-compiled function defined in
consult.el.
Signature
(consult--command-split STR)
Documentation
Return command argument and options list given input STR.
Source Code
;; Defined in ~/.emacs.d/elpa/consult-20260805.1130/consult.el
(defun consult--command-split (str)
"Return command argument and options list given input STR."
(save-match-data
(let ((opts ""))
(setq str (substring-no-properties str))
;; Find first option
(when (string-match "\\(?:\\`\\| \\)-" str)
(setq opts (substring str (1- (match-end 0)))
str (substring str 0 (match-beginning 0)))
(when (equal opts "-")
(setq opts "")))
;; Replace backslash-escaped dashes
(setq str (replace-regexp-in-string "\\(\\`\\| \\)\\\\-" "\\1-" str))
;; Options end with double dash
(when (string-match "\\(\\`\\| \\)--\\(?: \\|\\'\\)" opts)
(setq str (concat str " " (substring opts (match-end 0)))
opts (substring opts 0 (match-beginning 0))))
;; Use `split-string-shell-command' here instead of
;; `split-string-and-unquote' since it handles more flexible input -
;; double quoted strings, single quoted strings and escaped spaces.
(cons str (split-string-shell-command (string-trim opts))))))