Replies: 1 comment
-
|
@dasoju If you are trying to run a search with only "mdfind" as a source, then why don't you use the consult-backend? You can do something like: (defun consult-mdfind (&optional initial)
"Search with `mdfind' for files which match input given INITIAL input."
(interactive)
(let ((consult-locate-args '("mdfind")))
(find-file (consult--find "mdfind: " #'consult--locate-builder initial))))and then call Note that you can add additional command line arguments that you want to be used every time to the To be clear, the reason we can't add arguments on the fly in consult-omni is because different command line programs take different arguments, and in a multi-source search (which is what consult-omni enables), it is tricky to figure out what arguments are for which sources. Different programs may even use the same switch for different purposes. So, it is challenging to come up with a good general solution. The other point to keep in mind is that you can always start with a multi-source search with consult-omni (without all the command line arguments) as a starting point and if then you decide that you want to narrow down to "mdfind" and add some other arguments, then use |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi
Is there a way to pass arguments on the fly to the backend functions
For example, for mdfind i want to pass something like
[consult-omni-multi] Search: #xxx -- --name#yyy
assuming in the above example, mdfind is the only source for consult-omni-multi
I want to search for files with name xxx on my machine and then filter the filelist with yyy
typically, on terminal, i would do
mdfind -name xxx | grep yyy
above is just an example, instead of -name, can I use whatever argument the underlying command (in this case its mdfind) supports
From the documentation, I see that I would need to define an argument in the backend function for every option the underlying command supports, i think it will be better if i can specify the argument on the fly instead of enhancing backend functions
I tried the following instead, and got some results but got a lot of noise too
[consult-omni-multi] Search: # -name xxx
as soon as i typed -n it gave some errors, but once the command is finished it gave results at the end but minibuffer still has errors which were printed upfront, below is the snapshot

Beta Was this translation helpful? Give feedback.
All reactions