-
-
Notifications
You must be signed in to change notification settings - Fork 486
Description
Feature Request
When using lsd --tree, directories with many files dominate the output and make it hard to get a quick overview of the directory structure. I'd love an option to limit the number of files displayed per directory (e.g., --max-items 4 or a max_items config option).
Use Case
I use lsd in tree mode to get a quick sense of what's in a folder structure. My goal is to see enough of each directory's contents to decide whether it's worth drilling into — not to see every file. When a folder has dozens or hundreds of files, the tree becomes unwieldy and the useful signal from other directories gets buried.
A truncation limit (e.g., show the first N files and then something like ... and 42 more) would let me scan the tree, spot folders with relevant-looking contents, and then explore those specifically.
Proposed Behavior
$ lsd --tree --depth 2 --max-items 4
project/
├── src/
│ ├── index.ts
│ ├── config.ts
│ ├── utils.ts
│ ├── router.ts
│ └── ... (12 more)
├── tests/
│ ├── index.test.ts
│ └── config.test.ts
└── node_modules/
├── express/
├── lodash/
├── typescript/
├── eslint/
└── ... (847 more)
This could be a CLI flag (--max-items N) and/or a config.yaml option (max_items: N).
Prior Art
- eza has a similar request: Limit number of files printed per directory in tree mode? eza-community/eza#1103
- pandas uses a "first N / last N" display pattern for large datasets