-
-
Notifications
You must be signed in to change notification settings - Fork 815
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
--abs-path
and --rel-path
instead of --full-path
#839
Comments
I like that idea. Though we would probably want to keep |
Thank you for taking this into consideration! It makes sense to maintain backward compat. Separately, I realized there is |
Thank you for your request. I am definitely in favor of improving the documentation. It should be clear that we match on the full absolute path.
Could you explain this in more detail? What is your use case and why is it unergonomic to solve it with |
Say you have the following directory structure:
Let's say I'm in
|
In that particular case, you could use
|
That's fair, and I should have listed it as an option. However, I think the point remains valid. Your suggestion requires to "spread" my search between the Separately, the original use case that motivated this issue was to find a set of files under my working directory, some of which must be at a specific location, while others could be anywhere within the working directory. In the example above, starting from |
I can provide another case, which was very confusing for me. Let's assume that I'm working on a repository and I want to find all files related to |
I'm sorry, but I find both use cases obscure enough to reject this feature request (please refer to the "majority of use cases" statement in the README). I will update the documentation though. Thank you very much for the discussion. |
Honestly, I'm surprised by this decision. And now I'm wondering if I use find-like tools differently than others ppl, because this absolute path approach is the most counterintuitive thing for me. This topic was raised at least three times in gh issues, and it always ended the same, so I have no other choice than just accept your decision and never bring it up again. Third time's a charm, as they say. Thanks for your hard work. This tool is nearly perfect. 👍 |
Did you see that I updated the documentation (21fd013)? Does this help, or do you still think it's confusing?
Could you please point to the other issues. I honestly cannot remember that this was discussed somewhere else. There have been questions about
Please don't. I'll reopen this for now. |
Yes, I saw it, and yes, it is helpful improvement. 👍
Both. :) |
Hi David, thank you for reopening the issue. Ultimately this is your project and it's your prerogative to decline requests. However, if you don't mind me asking for clarification, could you help me understand your mental mode for this? Here is mine. When I search with In fact, I cannot think of a good example of when I'd want to match against the absolute path. If I had to pick only one of the two, I would favor relative paths to achieve the orthogonality mentioned above, but, assuming you have an equally reasonable mental model, supporting both options would support both mental models. |
I would also request the README to be changed to reflect this unintuitive behaviour. The current
I wish there was an example that shows how to use the absolute path functionality as rel-path e.g.:
on a side note, I think the |
Exactly! But if you want directories and criteria to be orthogonal (which I assume to mean: independent), the search criteria themselves shouldn't be modified by changing the search path. This is what we achieve by always taking the absolute path. Let's say I want to find files that contain
Now I would personally like to see the exact same search result, independent of what folder I'm currently in. This is why …
… also returns the @andreavaccari what do you think? Did I interpret your "orthogonal" property incorrectly? I just noticed that |
So it's a matter of taste. For others, it's quite unnatural behaviour. Especially if you were I'm pretty sure that there are people who will use and appreciate such addition. |
@sharkdp Yes you understood correctly what I meant with "orthogonal", and I now better understand your mental model. It seems we all agree that directories and criteria should be orthogonal/independent, but we disagree on what that means specifically. I think this difference stems from looking at the problem as the implementer of the program versus the user. From an implementation standpoint, it's easier to collect all the files in the user-specified directories, then independently match their (absolute) paths against the user-specified criteria. From an usage standpoint, it's more natural to define the directories to search and then the criteria assuming "nothing exists outside those directories". My points may not resonate with you but I do believe this thread has built a decent case for supporting this feature, especially considering that, as mentioned by @rafcamlet, it does not require a breaking change. Independent of your decision, thank you for building such a great tool! |
Hi @sharkdp, I agree on the intuition miss, and desire for absolute/relative path to be crystal clear. I just wrote a script that optionally used
It's quite counterintuitive that the matching expression I specify does not work against the outputs I receive -- I expect them to be the same "kind". (Plus it's also my in-built intuition after years of |
+1 that relative path feature would be useful for my use-case(s) and that the current implementation is not as intuitive to me |
I also want to express my support for this feature. I maintain the popular Emacs package Consult, which provides various file search and grep utilities. There I've recently added the Fd-based command |
Currently, fd does not expose a way to match against only the path components beneath the target path. When --full-path is specified, the pattern matches against all components. For example, executing consult-fd from /home/hlissner/.emacs.d with `home` as the query would match every file (not excluded by other arguments) under .emacs.d. Despite this --full-path behavior, fd still outputs relative paths, so the user cannot even determine why some candidates are returned. Until there is a method to match only against subdirectories, use --absolute-path to at least to show the user why all matches are occurring. Ref: sharkdp/fd#839
Currently, fd does not expose a way to match against only the path components beneath the target path. When --full-path is specified, the pattern matches against all components. For example, executing consult-fd from /home/hlissner/.emacs.d with `home` as the query would match every file (not excluded by other arguments) under .emacs.d. Despite this --full-path behavior, fd still outputs relative paths, so the user cannot even determine why some candidates are returned. Until there is a method to match only against subdirectories, use --absolute-path to at least to show the user why all matches are occurring. Ref: sharkdp/fd#839
Currently, fd does not expose a way to match against only the path components beneath the target path. When --full-path is specified, the pattern matches against all components. For example, executing consult-fd from /home/hlissner/.emacs.d with `home` as the query would match every file (not excluded by other arguments) under .emacs.d. Despite this --full-path behavior, fd still outputs relative paths, so the user cannot even determine why some candidates are returned. Until there is a method to match only against subdirectories, use --absolute-path to at least to show the user why all matches are occurring. Ref: sharkdp/fd#839
For the longest time I just assumed that What I find even more unexpected is the fact that the printed results are using the relative paths of the found files. This seems strange. Why do I need to filter by absolute paths but are shown the relative results? |
Currently, fd does not expose a way to match against only the path components beneath the target path. When --full-path is specified, the pattern matches against all components. For example, executing consult-fd from /home/hlissner/.emacs.d with `home` as the query would match every file (not excluded by other arguments) under .emacs.d. Despite this --full-path behavior, fd still outputs relative paths, so the user cannot even determine why some candidates are returned. Until there is a method to match only against subdirectories, use --absolute-path to at least to show the user why all matches are occurring. Ref: sharkdp/fd#839
Currently, fd does not expose a way to match against only the path components beneath the target path. When --full-path is specified, the pattern matches against all components. For example, executing consult-fd from /home/hlissner/.emacs.d with `home` as the query would match every file (not excluded by other arguments) under .emacs.d. Despite this --full-path behavior, fd still outputs relative paths, so the user cannot even determine why some candidates are returned. Until there is a method to match only against subdirectories, use --absolute-path to at least to show the user why all matches are occurring. Ref: sharkdp/fd#839
Currently, fd does not expose a way to match against only the path components beneath the target path. When --full-path is specified, the pattern matches against all components. For example, executing consult-fd from /home/hlissner/.emacs.d with `home` as the query would match every file (not excluded by other arguments) under .emacs.d. Despite this --full-path behavior, fd still outputs relative paths, so the user cannot even determine why some candidates are returned. Until there is a method to match only against subdirectories, use --absolute-path to at least to show the user why all matches are occurring. Ref: sharkdp/fd#839
Currently, fd does not expose a way to match against only the path components beneath the target path. When --full-path is specified, the pattern matches against all components. For example, executing consult-fd from /home/hlissner/.emacs.d with `home` as the query would match every file (not excluded by other arguments) under .emacs.d. Despite this --full-path behavior, fd still outputs relative paths, so the user cannot even determine why some candidates are returned. Until there is a method to match only against subdirectories, use --absolute-path to at least to show the user why all matches are occurring. Ref: sharkdp/fd#839
Any progress on this? how do i search the relative path in full-path style? |
fd --full-path
matches a pattern against the absolute path instead of the relative one. This is not well documented and it's a possible cause of confusion (e.g. #769). In my opinion, it is also less ergonomic than matching against the relative path of a candidate.My suggestion is:
--full-path
with--abs-path
to make it clear this matches against the absolute path--rel-path
to allow matching against the relative pathThank you for the great work and for your focus on usability!
The text was updated successfully, but these errors were encountered: