Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-x catch the <path>... arguments (if any) #1018

Open
ccqpein opened this issue May 14, 2022 · 2 comments
Open

-x catch the <path>... arguments (if any) #1018

ccqpein opened this issue May 14, 2022 · 2 comments

Comments

@ccqpein
Copy link

ccqpein commented May 14, 2022

What version of fd are you using?
[fd 8.3.1]

fd -h shows [<path>...] as the ARGS of fd.

fd [FLAGS/OPTIONS] [<pattern>] [<path>...]

However, for the special option -x, --exec <cmd>. There are two things:

  1. for example, if I run fd -I -t d '^target$' -x echo ./some_path. It gonna show the ./some_path first, then the query results followed.
  2. even the -x, --exec <cmd> is an option, but looks like it can only used after <pattern>.

For the first situation, I understand that -x is special and it is hard to tell if the path after it is the arguments of command or the search path. However, do you guys think it should be some warning inside README?

For the second situation, can we update the fd command's format like: fd [FLAGS/OPTIONS] [<pattern>] [-x/-X][<path>...]?

Thank you!

@tavianator
Copy link
Collaborator

-x eats everything that comes after it until ;, so if you want to you can write

$ fd -x echo \; pattern path

but it's a lot easier to just write

$ fd pattern path -x echo

This is mentioned in the README here, but isn't obvious from the fd -h output. fd --help has some examples, but none with patterns or paths that I see.

@sharkdp
Copy link
Owner

sharkdp commented May 15, 2022

Thank you for reporting this. Let's improve the documentation then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants