-
-
Notifications
You must be signed in to change notification settings - Fork 783
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
Add some sort of exec command. #84
Comments
|
The main point of |
Up |
It would be great if someone could come up with a specific plan on how this would work. Do we want to clone finds |
I reach for |
That's actually one thing that we have to think about when writing up a proposal on how this should be implemented. Since |
It was brought to my attention that, actually, It might be an opportunity for optimization, but, probably, it would be enough to document why |
@indeyets Thank you, I also didn't know that. I'm also starting to think that it might be better to not include I don't want to make any decision yet, though. Please keep the discussion going 👍 |
perhaps it would be sufficient to add in -exec with a small help description of how to use it in conjunction with xargs? I don't know enough about every single idiosyncrasies of xargs and find to know if there are other issues. |
I could easily implement this within a day, and possibly parallel command executions via a job pool, too. I've a lot of experience with this kind of software in Rust. I would recommend following GNU Parallel's syntax for command generation though. It's much more flexible than {} - simple placeholder token And bonus token: {^abc...} - remove a custom suffix |
@mmstick That sounds good 😄 Given that you wrote a Before we implement a feature like this, I would like to see at least a short outline on how this would feature would work exactly (which command-line options would be added? what would be the syntax of the
I should learn more about |
Interesting syntax for that... If you did add this to the utility, would it also be prudent to add in something like the following?
etc. to make it more explicit. the other tokens would still be matched on as well. The idea is analogous to |
It's just a rather simple feature that can easily exist within it's own standalone module. The main benefit would just be cutting out the middle man. I would think that just the
How It Would WorkYou could simply have it to where all arguments following When parsing the arguments, and seeing a command, you'd parse the command into a vector of string references & tokens. Something like an The default could be to just execute commands serially. A job pool can easily work if we string together a |
If there are any against it, I could also implement it as an optional feature, gated behind conditional compilation. |
@mmstick Sounds good, thank you very much for writing this up! I'm certainly not against this feature, but I'm curious what the advantage is over using |
Having to bring out |
Fair enough, in this case, let's go for it 😄. The feature has been asked for by a lot of people. Your help/contribution would be very much appreciated.
I think I would prefer to only support the first variant of this, i.e. just a normal command line option It seems to me that the other variant would be a possible source of confusion/errors.
We could still do this afterwards if it turns out we want this to be configurable. Right now, I don't see any need for this - but thanks for the suggestion. Another thing that just comes to my mind is platform-independence. Are there any complications that we could run into? |
This can be implemented in a platform-independent manner. |
I'll have a PR submitted later today, once I've documented and refactored what I've written so far. |
I am sure this utility could improve upon find's exec command to make a common thing easily accessible and powerful. xargs is not an awesome way to do it because of limitations with spaces in filenames.
interactive exec would be nice to have too. do a
fd --interactive-exec some_query
and then you are prompted for a command that doesn't need any special delimiters but would pass in things like %file %path %filename etc to the command that get parsed and replaced with a properly escaped and quoted string.Just spitballing ideas here as this is not a fully baked idea.
The text was updated successfully, but these errors were encountered: