feat(core+cli): add --recursive to dvs get#203
Open
CGMossa wants to merge 1 commit into
Open
Conversation
Carved out of #154 as the Rust-only layer. The R binding and the ui walkthrough follow as separate PRs. In dvs/src/globbing.rs: - resolve_paths_for_get gains a `recursive` parameter so that a positional directory argument can be walked recursively without requiring an explicit --glob. Mirrors the existing recursive behavior of `dvs status` for symmetry. - New tests cover: directory + recursive flag, mixed file + directory inputs, and the no-glob default path. In dvs-cli/src/main.rs: - `dvs get` gains `-r, --recursive` (clap short+long) wired through to resolve_paths_for_get. In dvs/src/files/status.rs: - One-line touch propagating the new globbing signature. No behavior change for callers that don't pass --recursive.
64dd1e1 to
d340c2b
Compare
Keats
reviewed
May 18, 2026
| /// At least one path or --glob must be provided. | ||
| #[command(next_display_order = 100)] | ||
| Get { | ||
| #[clap(required_unless_present = "glob")] |
Collaborator
There was a problem hiding this comment.
I would rather keep that than custom error messages since the CLI is unlikely to be used by most people, let's keep it simple.
Keats
requested changes
May 18, 2026
| /// We need to handle `.`, `./` etc but we can't canonicalize because | ||
| /// the path might not exist and we want the path relative to the directory so no symlink resolution | ||
| fn normalize_path(p: PathBuf) -> Option<PathBuf> { | ||
| pub(crate) fn normalize_path(p: PathBuf) -> Option<PathBuf> { |
Collaborator
There was a problem hiding this comment.
move it somewhere else if it's used by other parts of the code
| // If no paths given, default to cwd (or repo root if at root) | ||
| let dir_filters: Vec<PathBuf> = if paths.is_empty() { | ||
| vec![cwd_prefix.map(|p| p.to_path_buf()).unwrap_or_default()] | ||
| // None means no path restriction — all tracked files under cwd are candidates. |
Collaborator
There was a problem hiding this comment.
is that true? It's later that the files under cwd is handled
| vec![cwd_prefix.map(|p| p.to_path_buf()).unwrap_or_default()] | ||
| // None means no path restriction — all tracked files under cwd are candidates. | ||
| // The `recursive` flag only applies when explicit paths are given. | ||
| let dir_filters: Option<Vec<PathBuf>> = if paths.is_empty() { |
Collaborator
There was a problem hiding this comment.
I think we don't need the Option, it makes things more confusing
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.
AI-written details
Summary
Rust-only layer of
dvs get --recursive. Carved out of #154 as part of a 3-way split (this PR → rpkg binding → ui walkthrough).dvs/src/globbing.rs:resolve_paths_for_getgains arecursiveparameter so a positional directory argument can be walked recursively without requiring an explicit--glob. Mirrors the existing recursive behavior ofdvs statusfor command symmetry. New tests cover directory + recursive, mixed file/directory inputs, and the no-glob default path.dvs-cli/src/main.rs:dvs getgains-r, --recursive(clap short + long) wired through toresolve_paths_for_get.dvs/src/files/status.rs: one-line propagation of the new globbing signature.No behavior change for callers that don't pass
--recursive.Test plan
cargo test -p dvs --libpasses (73 + new cases)cargo check --workspace -- -D warningsclean./target/release/dvs get --helpshows-r, --recursive./target/release/dvs get some/dir -rwalks the directory; without-rit errors as beforeFollow-ups
dvs_get(recursive = ...)— separate PR (depends on this).ui/main_recursive.shexercising the matrix across add/get/status — separate PR.Drafted by Claude (claude-opus-4-7). Reviewed by the author.