diff --git a/Cargo.lock b/Cargo.lock index 98b5c78..a94aceb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -575,6 +575,12 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" +[[package]] +name = "either" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" + [[package]] name = "encode_unicode" version = "0.3.6" @@ -1042,6 +1048,15 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.6" @@ -1179,6 +1194,7 @@ dependencies = [ "full_moon", "futures-util", "include_dir", + "itertools", "lune", "once_cell", "regex", diff --git a/packages/cli/Cargo.toml b/packages/cli/Cargo.toml index eb41557..66fbc02 100644 --- a/packages/cli/Cargo.toml +++ b/packages/cli/Cargo.toml @@ -34,6 +34,7 @@ tokio.workspace = true anyhow = "1.0" env_logger = "0.10" +itertools = "0.10" clap = { version = "4.1", features = ["derive"] } full_moon = { version = "0.17", features = ["roblox"] } diff --git a/packages/cli/src/utils/files.rs b/packages/cli/src/utils/files.rs index 0c741cf..8f66cac 100644 --- a/packages/cli/src/utils/files.rs +++ b/packages/cli/src/utils/files.rs @@ -6,6 +6,7 @@ use std::{ use anyhow::{anyhow, bail, Result}; use console::style; use directories::UserDirs; +use itertools::Itertools; use once_cell::sync::Lazy; const LUNE_COMMENT_PREFIX: &str = "-->"; @@ -178,6 +179,8 @@ pub fn parse_lune_description_from_file(contents: &str) -> Option { let unindented_lines = comment_lines .iter() .map(|line| &line[shortest_indent..]) + // Replace newlines with a single space inbetween instead + .interleave(std::iter::repeat(" ").take(comment_lines.len() - 1)) .collect(); Some(unindented_lines) }