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 option for grouping directories at the top #798

Closed
ghost opened this issue Jul 20, 2021 · 2 comments
Closed

Add option for grouping directories at the top #798

ghost opened this issue Jul 20, 2021 · 2 comments

Comments

@ghost
Copy link

ghost commented Jul 20, 2021

ls already has something like this:

--group-directories-first
    group directories before files;

Basically what it would do is re-order fd output for displaying directories grouped at the top, before files, example below:

# before

a-file
b-folder-1
b-folder-2
c-file

# after (with -G)

b-folder-1
b-folder-2
a-file
c-file

The flag for this could be -G, as -g is already being used as the --glob option, and the description on the docs

@ghost ghost added the feature-request label Jul 20, 2021
@sharkdp
Copy link
Owner

sharkdp commented Aug 8, 2021

Thank you very much for your contribution!

This is similar to a --sort option that we decided not to implement for various reasons (see #324, for example). What you can do is to pipe to ls -G:

fd … -X ls -lhd --color=always --group-directories-first

@sharkdp sharkdp closed this as completed Aug 8, 2021
@ghost
Copy link
Author

ghost commented Aug 8, 2021

Many thanks @sharkdp, it worked!

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

No branches or pull requests

1 participant