feat(ls): implement -d/--directory flag#2132
Open
chaliy wants to merge 1 commit into
Open
Conversation
Deploying with
|
| 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
613b215 to
5b04ce9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Implement
ls -d/ls --directory: list directory operands themselves rather than descending into their contents (POSIX). Previously bashkit returnedls: option(s) not yet implemented in bashkit: directory.Why
Fixes #2127. The
directoryclap argument already existed in the generatedls_args(ported from uutils) but was gated out ofLS_SUPPORTED_IDS. The very commonls -d */idiom (enumerate subdirectories) was unusable, and an LLM eval run hit the not-implemented error in thefile_path_organizertask.How
directorytoLS_SUPPORTED_IDSand adirectoryfield toLsOptions.-dis set.-l(shows the directory's ownd…long entry) and-F/-C.Tests
Added three unit tests in
builtins/ls/tests.rs:ls -d subprintssub, not its contentsls -ld subshows the directory's own long entry (typed)ls -d alpha betaprints each operand (thels -d */idiom)All 78 ls-module tests pass;
cargo fmt --checkandcargo clippyclean.Generated by Claude Code