Skip to content

feat(ls): implement -d/--directory flag#2132

Open
chaliy wants to merge 1 commit into
mainfrom
claude/issue-2127-ls-directory
Open

feat(ls): implement -d/--directory flag#2132
chaliy wants to merge 1 commit into
mainfrom
claude/issue-2127-ls-directory

Conversation

@chaliy

@chaliy chaliy commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

What

Implement ls -d / ls --directory: list directory operands themselves rather than descending into their contents (POSIX). Previously bashkit returned ls: option(s) not yet implemented in bashkit: directory.

Why

Fixes #2127. The directory clap argument already existed in the generated ls_args (ported from uutils) but was gated out of LS_SUPPORTED_IDS. The very common ls -d */ idiom (enumerate subdirectories) was unusable, and an LLM eval run hit the not-implemented error in the file_path_organizer task.

How

  • Add directory to LS_SUPPORTED_IDS and a directory field to LsOptions.
  • In the operand-splitting loop, a directory operand is routed to the file-argument path (printed as its own name / long entry) instead of the descend-and-list path when -d is set.
  • Works with -l (shows the directory's own d… long entry) and -F/-C.

Tests

Added three unit tests in builtins/ls/tests.rs:

  • ls -d sub prints sub, not its contents
  • ls -ld sub shows the directory's own long entry (type d)
  • ls -d alpha beta prints each operand (the ls -d */ idiom)

All 78 ls-module tests pass; cargo fmt --check and cargo clippy clean.


Generated by Claude Code

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 28, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
bashkit 5b04ce9 Commit Preview URL

Branch Preview URL
Jun 28 2026, 01:43 AM

List directory operands themselves instead of descending into them,
per POSIX. Enables the common `ls -d */` idiom to enumerate
subdirectories. A directory operand under -d is rendered like a file
argument (its own name, or its own long entry with -l/-F).

Closes #2127
@chaliy chaliy force-pushed the claude/issue-2127-ls-directory branch from 613b215 to 5b04ce9 Compare June 28, 2026 01:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(ls): -d / --directory not implemented

1 participant