Skip to content

Commit

Permalink
Better output from snippets command
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Jul 16, 2024
1 parent 25435de commit 22263df
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions docs/snippets/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,10 @@ fn main() {
let args: Vec<String> = std::env::args().skip(1).collect();
if args.is_empty() {
eprintln!("Usage: {} <snippet-name>\n", std::env::args().next().unwrap_or("snippets".to_owned()));
eprintln!("Available snippets ${SNIPPETS}:\n");
eprintln!("Usage: {} <snippet-name>", std::env::args().next().unwrap_or("snippets".to_owned()));
eprintln!("Available snippets:");
eprintln!("");
eprintln!("${SNIPPETS}");
std::process::exit(1);
}
Expand All @@ -111,7 +113,7 @@ fn main() {
"${MODS}",
&snippets.iter().map(|m| format!("mod {m};")).join("\n"),
)
.replace("${SNIPPETS}", &snippets.iter().join(" "))
.replace("${SNIPPETS}", &snippets.iter().join("\\n"))
.replace(
"${MATCH_SNIPPETS}",
&snippets
Expand Down

0 comments on commit 22263df

Please sign in to comment.