From 1b2a35509cb21429daaad7ef75bc8f2727a18d23 Mon Sep 17 00:00:00 2001 From: kjuulh Date: Sun, 24 Aug 2025 17:44:04 +0200 Subject: [PATCH] feat: move also creates parent dir on destination Signed-off-by: kjuulh --- crates/noil/src/cli/edit.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/noil/src/cli/edit.rs b/crates/noil/src/cli/edit.rs index a4cb656..2ad4ea2 100644 --- a/crates/noil/src/cli/edit.rs +++ b/crates/noil/src/cli/edit.rs @@ -328,6 +328,14 @@ pub async fn apply(input: &str, options: ApplyOptions) -> anyhow::Result<()> { anyhow::bail!("destination already exists cannot move"); } + if let Some(parent) = existing.path.parent() + && !parent.exists() + { + tokio::fs::create_dir_all(&parent) + .await + .context("failed to create dest for move")?; + } + tokio::fs::rename(&existing.path, path) .await .context("move path")?;