Skip to content

Add --dry-run flag to mkdir#340

Merged
AndreyVMarkelov merged 1 commit into
masterfrom
feature/mkdir-dry-run
Jul 8, 2026
Merged

Add --dry-run flag to mkdir#340
AndreyVMarkelov merged 1 commit into
masterfrom
feature/mkdir-dry-run

Conversation

@AndreyVMarkelov

@AndreyVMarkelov AndreyVMarkelov commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Extends dry-run support to dbxcli mkdir, reusing the shared helpers introduced with rm --dry-run. 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.

This is the second command to adopt the shared cmd/dry_run.go helpers, which validates the abstraction. It also includes two small cleanups:

  • Extract dryRunDisplayPath — the duplicated displayPath logic (present-or-fallback) is hoisted into a shared helper now used by both rm and mkdir.
  • Reword the flag help to Preview intended writes without making changes, which better reflects that dry-run previews intent rather than exact outcome (mkdir's offline preview reports planned even where a real run would report existing).

The help manifest, JSON contract, input/definition schemas, and docs are updated to include the dry_run input and planned status for mkdir.

Design note

mkdir --dry-run is a fully offline preview — it calls neither CreateFolderV2 nor GetMetadata (tests assert both). This is intentional: mkdir's execute path is tangled with conflict handling and doesn't cleanly split into validate/skip like rm does. The reworded flag help frames the contract as "preview intended writes," which both commands satisfy honestly.

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.
@AndreyVMarkelov AndreyVMarkelov merged commit 6647659 into master Jul 8, 2026
13 checks passed
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.

1 participant