Canop / broot

A new way to see and navigate directory trees : https://dystroy.org/broot
MIT License
10.62k stars 234 forks source link

Is there a way to print the file list and exit, just like `ls`? #895

Closed leira closed 3 months ago

leira commented 3 months ago

I like broot. It of course supersets the features of ls. I'd like to use it to fully replace ls. Can br behave like ls, that to print the list of files and exit right away, for the use cases to just have a peak of the files list? Thanks!

Canop commented 3 months ago

Yes. You can launch br -c :pt.

I recommend having a shortcut for that, so that it's easier to add other arguments. See https://dystroy.org/broot/tricks/#replace-tree

Canop commented 3 months ago

I frequently run commands like tree -s:

image

leira commented 3 months ago

This is great! Thanks!

One more question. Is it possible to show a simple list of files, just like ls, for shell one liners? I tried br --no-tree -c ":pt". It still shows the tree structure lines.

󰈺 br --no-tree -c ":pt"
.../nix-config
 ├──dim-screen.sh
 ├──flake.lock
 ├──flake.nix
 ├──home-manager …
 ├──modules …
 ├──nixos …
 ├──nixpkgs.nix
 ├──overlays …
 ├──pkgs …
 ├──README.md
 ├──shell.nix
 ├──xrandr-dim.sh
 └──xrandr-dim.sh~
Canop commented 3 months ago

Why ? I mean what would be the difference with ls ?

leira commented 3 months ago

You are right. I should just use ls for this use case. I have eza installed as a drop in ls replacement through an alias. Now I'm thinking about ditching eza in favor of br. In the same mindset, I want br to cover all the use cases I use eza for.

Anyway, thanks for the response and this amazing project!

Canop commented 3 months ago

ls is always installed on your computer. I'd recommend keeping it for just the case you need to pipe a list into another program, not alias it, and use br for all other cases.

If you'd like broot features (like searching, computing sums, etc.) but still dump a raw list, then a feature request as a dedicated GitHub issue is welcome.