-
-
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
Display directories with trailing slashes #436
Comments
Thank you for the feedback. I don't think there is any precedent for this ( |
There is precedent in |
Thanks, I didn't know that. My main point is that I'd rather not add a command-line option for something minor like this, as I really strive to keep the CLI small. So the question becomes: Do we want to add a trailing slash by default? (I'd rather not). If we don't, should there be some other way to make this possible (e.g. a more generic Silly workaround 😄:
|
In my opinion, if
And parsing |
Arguably, using
I'm assuming you mean "… at the minimum". The very first paragraph in the README explicitly says: "fd […] does not seek to mirror all of find's powerful functionality […]". So no, even if |
I'd like to close this. Let me know if there is anything left that should be discussed. |
"tar -tf" shows trailing slashes
If common.list contains folders, they must have a trailing slash, otherwise tar will complain "./dir Not found in archive" In most scripting use cases, controlling whether you get the trailing slash is important. It is pretty easy to delete the trailing slash with regex, but there is no good way to add the trailing slash without checking the filesystem again to see what is a dir and what isn't. Without the trailing slash, the output of fd is actually missing information, there is no good way to add the trailing slash without checking the filesystem again to see what is a dir and what isn't. Either this should be an option, or it should be the default. |
Another workaround:
(although, I think that might miss non-regular, non-link files) |
If you are not sure if something is a file or a directory.. you probably also don't care if it has a trailing slash or not. It's not like you can append to the path, for example. Because it could be a file. It would be great if you could describe a real world use case where you would find the trailing slash useful. I would suspect that most use cases actually lead to a
True. But as I pointed out above, so do most other programs. That's not necessarily a good reason, but I guess it shows that there aren't too many use cases that would require a trailing slash. |
fwiw, a real-world use case I've literally just come up with is a script that post-processes the output of fd to add links; obviously it's easy to just take a whole line and transform it into a link, but it would be nice if, for files, I could make the directory-name part of the line link to the directory (e.g. to open in a file manager), and the filename part link directly to the file. As things stand, files and directories are differentiated by colour, but not by anything else, so I'd have to either rely on parsing the colour escape sequences (fraught, since they come from Given that the difference between files and directories (and executables, symlinks, ...) are already illustrated with colour, it would be nice to make those differences accessible to scripts as well, like (also, apart from anything else, I just like seeing trailing slashes on directories? it makes them more visually distinct from files, so I have |
I'm not saying this is a good solution, but in a scripting environment, you could set |
I'm going to reopen this. Please vote with 👍 (you would like to see trailing slashes for directories by default) and 👎 (you would rather not see trailing slashes) on this comment to indicate your preference. I think I'm inclined to add this to What I would vote against is having a new command line option for this. |
On balance, getting rid of the / is easy: If you do make a cmd arg, it should probably be a more general "output format" type thing |
I'm not saying that it doesn't, but .. in which reasonable scenario would it really break things? Another thing to worry about is the --exec commands. |
For an example. I currently have scripts in which the output of Basically any situation where you compare fd's output to something else will have to be corrected. ... now that I'm thinking about it, It might break alot of my stuff, god only knows. |
Right. That's actually a good point. |
I'd very much like to see this added. Use case is to prepend icons with this iconlookup script I wrote. Using the Would be great to see this functionality in |
Pro: helps identity directories if color is ever disabled |
I decided appending / is a better, cleaner solution for quick cd than appending ./ - since prepending ./ is causing issues when the path starts with . or /, why not just append /? fd never appends / to its output so this is safe to do (see sharkdp/fd#436) - of course, we can't just append / to everything; we need to test if the path is actually a directory, but since we only do this when there's one path selected, it's not performance hindering - a / at the end of only directories is cleaner, more natural, and has a more comprehensible than prepending ./ to anything even when it's not needed - the code and documentation become much more straightforward - this will remove support for executables, which cuts back on product debt - fixes #171 (is compatible with hidden directories) This is about the same as the PR that started this all (#72) except we're using a trailing / instead. Do note that symlink behavior changes if the directory has a trailing / (#185 (comment)).
I feel that the trailing |
How about someone tries to implement this so we can see how it would look like? I think it shouldn't be too hard. |
Adding this to the "fd 9" milestone. Which doesn't necessarily mean that we implement this. But I want to settle this question. |
Just thought of something: GNU ls has the
Maybe it would be better to add something similar instead of just the path separator? |
Could i try working on this issue? |
@Rishit-Khandelwal there's already #812 (just for the trailing slashes, not |
So should i work on |
Hello, I am fairly new to github issues. I am just curious to know if this is under development right now. To be honest, my use case is different. When I use fd with fzf, I use the CTRL-T command which lists everything recursively, files and dirs. It's hard to distinguish files from dirs. the / at the end would be help greatly. I understand my use case is very specific. Let me know if this is going to be implemented or if you're aware of a workaround. Happy New Year! :) |
This is being worked on in #812, as described above. |
Thank you for your response and your work, David.
…On Sun, Jan 23, 2022, 12:15 David Peter ***@***.***> wrote:
This is being worked on in #812 <#812>,
as described above.
—
Reply to this email directly, view it on GitHub
<#436 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAWMCNMYPWPUDCSDP4AG3EDUXPWNZANCNFSM4HLGE3TQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
closed in #812. |
fd behavior changed in v8.4.0 to print a trailing path separator after directories. • sharkdp/fd#436 ↳ Display directories with trailing slashes • sharkdp/fd#812 ↳ Append trailing path separators to directories
HI,
It will be great if there will be a possibility to have directories displayed with a trailing "/" (as an option or not).
When you don't use colors, there is no way to distinct directories from files.
Regards,
The text was updated successfully, but these errors were encountered: