Skip to content

Commit 3e2da66

Browse files
committed
added link to problem in pack
1 parent 81a4c3f commit 3e2da66

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/utils.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use std::path::Path;
22

3-
use crate::GIT_README;
43
use crate::file_parser::codefile::CodeFile;
54
use crate::handlers::leetcode::{Authorized, LeetCode};
65
use crate::handlers::utils::{ExecutionResult, SubmissionResult};
6+
use crate::GIT_README;
77

88
use eyre::{bail, Result};
99

@@ -65,7 +65,7 @@ pub(crate) fn pack(lc: &LeetCode<Authorized>, file: Option<std::path::PathBuf>)
6565
// create a directory if it doesn't exists with name of question
6666
// create a README.md file with the question description
6767
// create a file with the code
68-
std::fs::create_dir_all(&code_file.question_title.replace(' ', ""))?;
68+
std::fs::create_dir_all(&code_file.question_title)?;
6969

7070
std::fs::write(
7171
format!(
@@ -88,7 +88,11 @@ pub(crate) fn pack(lc: &LeetCode<Authorized>, file: Option<std::path::PathBuf>)
8888
);
8989
std::io::Write::write_all(
9090
&mut readme_file,
91-
format!("# {}\n", code_file.question_title).as_bytes(),
91+
format!(
92+
"# {title}\n[Link to Problem](https://leetcode.com/problems/{title}/description)\n\n",
93+
title = code_file.question_title
94+
)
95+
.as_bytes(),
9296
)?;
9397
std::io::Write::write_all(&mut readme_file, question.content.as_bytes())?;
9498
} else {

0 commit comments

Comments
 (0)