lsd-rs / lsd-rs/lsd

Feature request: limit number of files shown per directory in tree mode

Open
#1,188 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
16.2k
Forks
510
PR merge metrics
No merged PRs in 30d

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Start by tracing the existing lsd --tree entry point and how command-line and configuration options are defined. Done means a per-directory limit is supported, excess items are represented clearly, and the requested --max-items N and/or max_items: N behavior is covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.