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

Add a -l flag for listing more details about the files. #491

Closed
tewalds opened this issue Oct 1, 2019 · 6 comments · Fixed by #556
Closed

Add a -l flag for listing more details about the files. #491

tewalds opened this issue Oct 1, 2019 · 6 comments · Fixed by #556
Assignees
Milestone

Comments

@tewalds
Copy link

tewalds commented Oct 1, 2019

fd is great for listing the files that match some pattern, but if I want to know more details about those files (eg permissions, size, owner, modification date) I need to run them through ls or exa. fd pattern -x ls -l isn't such a great experience though: it isn't colored, the order is random, and the columns don't align if the file sizes aren't similar. Given that -l is the most common flag to ls, why not also support it in fd?

@sharkdp
Copy link
Owner

sharkdp commented Oct 2, 2019

Thank you for your feedback.

fd pattern -x ls -l isn't such a great experience though: it isn't colored, the order is random, and the columns don't align if the file sizes aren't similar.

All of this can be solved by using --exec-batch/-X instead of --exec/-x and telling ls to colorize the results:

fd … -X ls -l --color=auto

@tewalds
Copy link
Author

tewalds commented Oct 2, 2019

I tried -X, but it didn't work, though maybe that's because I'm using the version in apt. Either way, fd … -X ls -l --color=auto doesn't exactly roll off the tongue. Could fd -l ... be a shortcut for that?

@sharkdp
Copy link
Owner

sharkdp commented Oct 6, 2019

I tried -X, but it didn't work, though maybe that's because I'm using the version in apt.

-X has been introduced in fd 7.3.0.

Either way, fd … -X ls -l --color=auto doesn't exactly roll off the tongue. Could fd -l ... be a shortcut for that?

I certainly don't want to add ls -l-like functionality to fd, but I might be convinced to add something like this as an alias for -X ls -l --color=auto. This could also be a nice solution for #482.

However, I would first like to leave this for discussion.

A possible counter-argument is that we would have to choose a particular set of command-line options for ls. ls -l --color=always would be one choice, but others might prefer a different combination.

@tewalds
Copy link
Author

tewalds commented Oct 7, 2019

If the argument against adding ls -l functionality to fd directly is the amount of extra work and code duplication, maybe exa can be used as a library? It's also in rust and already implements ls -l functionality, with colors.

As for --color=auto vs always, why not tie that to fd's own --color flag? Just propagate it through to ls.

@sharkdp sharkdp added this to the v8.0 milestone Apr 2, 2020
@sharkdp sharkdp self-assigned this Apr 2, 2020
sharkdp added a commit that referenced this issue Apr 2, 2020
Add a new `-l`/`--list` option to show more details about the search results. This is basically
an alias for `--exec-batch ls -l` with some additional `ls` options.
This can be used in order to:
    * see metadata like permissions, owner, file size, modification times (#491)
    * see symlink targets (#482)
    * achieve a determinstic output order (#324, #196, #159)
    * avoid duplicate search results when multiple search paths are given (#405)
sharkdp added a commit that referenced this issue Apr 2, 2020
Add a new `-l`/`--list` option to show more details about the search results. This is basically
an alias for `--exec-batch ls -l` with some additional `ls` options.
This can be used in order to:
    * see metadata like permissions, owner, file size, modification times (#491)
    * see symlink targets (#482)
    * achieve a deterministic output order (#324, #196, #159)
    * avoid duplicate search results when multiple search paths are given (#405)
sharkdp added a commit that referenced this issue Apr 3, 2020
Add a new `-l`/`--list` option to show more details about the search results. This is basically
an alias for `--exec-batch ls -l` with some additional `ls` options.
This can be used in order to:
    * see metadata like permissions, owner, file size, modification times (#491)
    * see symlink targets (#482)
    * achieve a deterministic output order (#324, #196, #159)
    * avoid duplicate search results when multiple search paths are given (#405)
@sharkdp
Copy link
Owner

sharkdp commented Apr 3, 2020

This has been implemented in #556.

@sharkdp
Copy link
Owner

sharkdp commented Apr 16, 2020

This has now been released in fd v8.0.

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

Successfully merging a pull request may close this issue.

2 participants