Skip to content

feat(ls): support -d/--directory to list directories themselves#2134

Merged
chaliy merged 1 commit into
mainfrom
fix/ls-directory-flag
Jun 28, 2026
Merged

feat(ls): support -d/--directory to list directories themselves#2134
chaliy merged 1 commit into
mainfrom
fix/ls-directory-flag

Conversation

@chaliy

@chaliy chaliy commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Motivation

ls -d / ls --directory (list directory entries themselves, not their contents) was not implemented — bashkit returned ls: option(s) not yet implemented in bashkit: directory. This blocks the extremely common ls -d */ idiom for enumerating subdirectories.

Found in the LLM eval run 2026-06-27 (mira harness), task file_path_organizer.

Closes #2127.

Changes

  • crates/bashkit/src/builtins/ls/list.rs: add directory to the supported-arg allowlist; thread a directory flag through LsOptions; when set, treat directory arguments like ordinary non-directory entries (list the entry itself rather than descending). -F still appends the trailing / because the classify suffix keys off the entry metadata.
  • crates/bashkit/src/builtins/ls/tests.rs: tests for -d, --directory, multiple directory args (the ls -d */ case), and -dF classify suffix.
  • crates/bashkit/docs/compatibility.md: refresh the ls supported-flag list (also adds previously-undocumented -t/-F/-C).

Testing

  • cargo test -p bashkit --features http_client,ssh,sqlite --lib builtins::ls::tests::test_ls_directory → 4 passed.

Generated by Claude Code

Implements `ls -d` / `ls --directory`, which lists directory entries
themselves rather than descending into their contents (POSIX). This
unblocks the very common `ls -d */` idiom for enumerating subdirectories.

Directory arguments are treated like ordinary non-directory entries when
-d is set; `-F` still appends the trailing `/` because the classify
suffix keys off the entry metadata.

Closes #2127
@cloudflare-workers-and-pages

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 7d1a465 Commit Preview URL

Branch Preview URL
Jun 28 2026, 09:23 AM

@chaliy chaliy merged commit 12e50f3 into main Jun 28, 2026
39 checks passed
@chaliy chaliy deleted the fix/ls-directory-flag branch June 28, 2026 09:33
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