Add --dry-run flag to mkdir#340
Merged
Merged
Conversation
Extend dry-run support to mkdir, reusing the shared helpers from dry_run.go. With --dry-run, mkdir previews the intended folder creation without calling CreateFolderV2: it reports a "planned" JSON status and prints "Would create directory <path>" in text mode. Also extract the duplicated displayPath logic into a shared dryRunDisplayPath helper (now used by both rm and mkdir) and reword the --dry-run flag help to "Preview intended writes without making changes", which better reflects that dry-run previews intent rather than exact outcome. Updates the help manifest, JSON contract, input/definition schemas, and docs to include the dry_run input and planned status for mkdir.
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.
Summary
Extends dry-run support to
dbxcli mkdir, reusing the shared helpers introduced withrm --dry-run. With--dry-run,mkdirpreviews the intended folder creation without callingCreateFolderV2: it reports aplannedJSON status and printsWould create directory <path>in text mode.This is the second command to adopt the shared
cmd/dry_run.gohelpers, which validates the abstraction. It also includes two small cleanups:dryRunDisplayPath— the duplicateddisplayPathlogic (present-or-fallback) is hoisted into a shared helper now used by bothrmandmkdir.Preview intended writes without making changes, which better reflects that dry-run previews intent rather than exact outcome (mkdir's offline preview reportsplannedeven where a real run would reportexisting).The help manifest, JSON contract, input/definition schemas, and docs are updated to include the
dry_runinput andplannedstatus formkdir.Design note
mkdir --dry-runis a fully offline preview — it calls neitherCreateFolderV2norGetMetadata(tests assert both). This is intentional: mkdir's execute path is tangled with conflict handling and doesn't cleanly split into validate/skip likermdoes. The reworded flag help frames the contract as "preview intended writes," which both commands satisfy honestly.