uutils / uutils/coreutils

ls: [cleanup] each column to keep track of its own width

Open
#11,790 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

U - ls
Dominant language
Rust
Stars
24.1k
Forks
2k
Avg merge
1d 5h
Merged PRs (30d)
365

Description

From https://github.com/uutils/coreutils/issues/10980#issuecomment-4232741589:


I find it really unclean, hacky code that if there's more space needed for the permissions (due to some ACLs) then you keep track of it by increasing the padding of link count, the next field.

Such approach is semantically bad, and will break if you ever add various other output formats (let alone the possibility of user-defined list of columns).

In clean code, each property should keep track of its own required width.

Maybe you want to refactor this part?

Contributor guide

Open the contributing guide

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

Start by locating the ls output-formatting code that calculates column widths, then trace how extra permission width currently affects the link-count field. Refactor the width tracking so each property owns its required width, and verify that existing ls output and tests remain correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.