Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upImprove the '--exec' help text #605
Comments
|
Do you think the size of the explanations for The examples should be the same for the man pages and the help output right? |
I would not make the text on this less detailed. I just would like it to be a little bit less in the spotlight. It's not the first thing users should learn when reading about
Yes |
|
the manpage definitely needs more attention regarding |
Hm, not necessarily. |
|
i was fooled by both the manpage and |
Hm, true. On the other hand, most "USAGE"/"SYNOPSIS" sections are written like this, even if the programs support flags/options after the positional arguments. Take
It still supports things like In fact, I think this is a quite essential feature for a command line interface. It allows users to easily repeat the last command while adding a new option (without having to move the cursor in front of the position arguments). If you think we should improve the documentation in this respect, let us know.
I can definitely see why you would think that. Let's add this to the list of things that should be improved in this ticket.
It would have made (this part of) parsing easier, yes. We still decided against this. There are several reasons:
|
Totally agree. I've encountered programs that absolutely require options to come before arguments, and found it very annoying. |
|
sure, but passing a string feels natural, no matter the position |
|
Would you consider also adding an example of using A somewhat trivial example of via a script
#!/usr/bin/env sh
cat "$1" > "$2"$ fd -e .txt --exec ./cat.sh {} ../{/} \; . .one-liner$ fd -e .txt --exec sh -c "cat {} > ../{/}" \; . .I appreciate there may be a better way of doing this that I haven't figured out. |
|
Using an intermediate shell script is the best option here, I believe. Your first version is fine, but could be simplified to (this is what this ticket is about):
The one-liner is not equivalent and will fail for more complex filenames with spaces, for example. Using |
Maybe, but I think I gave a couple of reasons why this is not a good idea. Note that |
I see a lot of
fdusers that seem to think that they need to add"{}"to all commands. Some users also seem to think that the closing semicolon (which needs to be escaped)\;is required:In reality, 90% of the
--execuse cases can be written without the"{}"part (whichfdadds, if it is ommitted) because the file entry often comes last. The semicolon is never required if we teach users to put the--execargument last.I would like to improve several things in the documentation:
{}/{.}/{/}/… syntax and show more simple examples likefd … -x wc -lorfd … -X vimfirst.--helptext and the man page should also be updated accordingly. I think two or three simple examples should also go inside the--helptext and definitely into the man page.