Skip to content

Commit

Permalink
fix(init): don't gitignore triple-dash
Browse files Browse the repository at this point in the history
The `---` is only for the `README.md` file, not `gitignore`.

I've also switched the "(ab)used link label (for use with reference
style links)"-style comment (`[//] #`) for an HTML comment (`<!-- ...
-->`). This means it will be rendered in the HTML, which might be
preferable, and is at a minimum benign. I hadn't been familiar with the
`[//]: #`-style comment until I saw it here (and searched to find a
description of it, along with the "(ab)use" line above, [here]), and I
don't think it's worth the potential confusion for users of `soroban
contract init`.

  [here]: https://stackoverflow.com/a/20885980/249801
  • Loading branch information
chadoh committed Apr 25, 2024
1 parent 9d7ad07 commit 7e841a8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmd/soroban-cli/src/commands/contract/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,14 +422,14 @@ fn append_contents(from: &Path, to: &Path) -> Result<(), Error> {

fn get_merged_file_delimiter(file_path: &Path) -> String {
let comment = if file_path.to_string_lossy().contains("README.md") {
"[//]: # \"The following is the Frontend Template's README.md\"".to_string()
"---\n<!-- The following is the Frontend Template's README.md -->".to_string()
} else if file_path.to_string_lossy().contains("gitignore") {
"# The following is from the Frontend Template's .gitignore".to_string()
} else {
String::new()
};

format!("\n\n---\n\n{comment}\n\n").to_string()
format!("\n\n{comment}\n\n").to_string()
}

#[cfg(test)]
Expand Down

0 comments on commit 7e841a8

Please sign in to comment.