From b08a5c016db230f872b5a4ddac52cf5499197b05 Mon Sep 17 00:00:00 2001 From: Jinghui Hu Date: Tue, 22 Aug 2023 06:36:56 +0800 Subject: [PATCH 01/27] feat: change domain to leetcode cn --- src/config/sys.rs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/config/sys.rs b/src/config/sys.rs index 7c6f77e..8d6145b 100644 --- a/src/config/sys.rs +++ b/src/config/sys.rs @@ -33,20 +33,20 @@ pub struct Urls { impl Default for Urls { fn default() -> Self { Self { - base: "https://leetcode.com".into(), - graphql: "https://leetcode.com/graphql".into(), - login: "https://leetcode.com/accounts/login/".into(), - problems: "https://leetcode.com/api/problems/$category/".into(), - problem: "https://leetcode.com/problems/$slug/description/".into(), - tag: "https://leetcode.com/tag/$slug/".into(), - test: "https://leetcode.com/problems/$slug/interpret_solution/".into(), - session: "https://leetcode.com/session/".into(), - submit: "https://leetcode.com/problems/$slug/submit/".into(), - submissions: "https://leetcode.com/submissions/detail/$id/".into(), - submission: "https://leetcode.com/submissions/detail/$id/".into(), - verify: "https://leetcode.com/submissions/detail/$id/check/".into(), - favorites: "https://leetcode.com/list/api/questions".into(), - favorite_delete: "https://leetcode.com/list/api/questions/$hash/$id".into(), + base: "https://leetcode.cn".into(), + graphql: "https://leetcode.cn/graphql".into(), + login: "https://leetcode.cn/accounts/login/".into(), + problems: "https://leetcode.cn/api/problems/$category/".into(), + problem: "https://leetcode.cn/problems/$slug/description/".into(), + tag: "https://leetcode.cn/tag/$slug/".into(), + test: "https://leetcode.cn/problems/$slug/interpret_solution/".into(), + session: "https://leetcode.cn/session/".into(), + submit: "https://leetcode.cn/problems/$slug/submit/".into(), + submissions: "https://leetcode.cn/submissions/detail/$id/".into(), + submission: "https://leetcode.cn/submissions/detail/$id/".into(), + verify: "https://leetcode.cn/submissions/detail/$id/check/".into(), + favorites: "https://leetcode.cn/list/api/questions".into(), + favorite_delete: "https://leetcode.cn/list/api/questions/$hash/$id".into(), } } } From 7088b4c6a319d3016fa2a68cdaf986421c8ddc86 Mon Sep 17 00:00:00 2001 From: Jinghui Hu Date: Tue, 22 Aug 2023 06:53:25 +0800 Subject: [PATCH 02/27] feat: padding code file --- src/cache/models.rs | 4 ++++ src/helper.rs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/cache/models.rs b/src/cache/models.rs index 12c512e..23b7ae6 100644 --- a/src/cache/models.rs +++ b/src/cache/models.rs @@ -49,6 +49,10 @@ impl Problem { res + "\n" } + + pub fn get_fid(&self) -> String { + format!("{:0>4}", self.fid) + } } static DONE: &str = " ✔"; diff --git a/src/helper.rs b/src/helper.rs index db1a77e..7a78a59 100644 --- a/src/helper.rs +++ b/src/helper.rs @@ -215,7 +215,7 @@ mod file { suffix(&lang)?, ); - path = path.replace("${fid}", &problem.fid.to_string()); + path = path.replace("${fid}", &problem.get_fid()); path = path.replace("${slug}", &problem.slug.to_string()); Ok(path) From 6d73ada1865a4acecd28afed1a57ce4254557522 Mon Sep 17 00:00:00 2001 From: Jinghui Hu Date: Tue, 22 Aug 2023 06:55:09 +0800 Subject: [PATCH 03/27] v0.5.0 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index ec01180..6fd908f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ path = "src/bin/lc.rs" [package] name = "leetcode-cli" -version = "0.4.1" +version = "0.5.0" authors = ["clearloop "] edition = "2021" description = "Leetcode command-line interface in rust." From f31fda2dbdb5558a292eaf39a4fda6ef08d0e3d9 Mon Sep 17 00:00:00 2001 From: Jinghui Hu Date: Tue, 22 Aug 2023 08:08:25 +0800 Subject: [PATCH 04/27] update: format testcase data --- src/helper.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/helper.rs b/src/helper.rs index 7a78a59..51c31e2 100644 --- a/src/helper.rs +++ b/src/helper.rs @@ -195,7 +195,7 @@ mod file { let conf = crate::config::Config::locate()?; let mut path = format!("{}/{}.tests.dat", conf.storage.code()?, conf.code.pick); - path = path.replace("${fid}", &problem.fid.to_string()); + path = path.replace("${fid}", &problem.get_fid()); path = path.replace("${slug}", &problem.slug.to_string()); Ok(path) } From 837c2a463acad51aad30554b31916310556a42cb Mon Sep 17 00:00:00 2001 From: Jinghui Hu Date: Tue, 22 Aug 2023 08:32:37 +0800 Subject: [PATCH 05/27] add --- Cargo.lock | 2 +- src/cache/models.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a922655..91128e3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1056,7 +1056,7 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "leetcode-cli" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "async-trait", diff --git a/src/cache/models.rs b/src/cache/models.rs index 23b7ae6..107d82c 100644 --- a/src/cache/models.rs +++ b/src/cache/models.rs @@ -51,7 +51,7 @@ impl Problem { } pub fn get_fid(&self) -> String { - format!("{:0>4}", self.fid) + format!("s{:0>4}", self.fid) } } From 5379936e01b179f3ff32821a2c71ac4e0d9d7551 Mon Sep 17 00:00:00 2001 From: Jinghui Hu Date: Tue, 22 Aug 2023 08:35:59 +0800 Subject: [PATCH 06/27] fix --- src/config/code.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config/code.rs b/src/config/code.rs index 0384608..5a65cb1 100644 --- a/src/config/code.rs +++ b/src/config/code.rs @@ -47,7 +47,7 @@ impl Default for Code { comment_leading: "".into(), test: true, lang: "rust".into(), - pick: "${fid}.${slug}".into(), + pick: "${fid}_${slug}".into(), submission: "${fid}.${slug}.${sid}.${ac}".into(), } } From 2f7353e36085cb00c4e068cb842c6380a21fb272 Mon Sep 17 00:00:00 2001 From: Jinghui Hu Date: Tue, 22 Aug 2023 08:36:26 +0800 Subject: [PATCH 07/27] v0.5.2 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 6fd908f..a1d7086 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ path = "src/bin/lc.rs" [package] name = "leetcode-cli" -version = "0.5.0" +version = "0.5.2" authors = ["clearloop "] edition = "2021" description = "Leetcode command-line interface in rust." From 5b1b140f068093343dec3d5efd72295dc1c7b737 Mon Sep 17 00:00:00 2001 From: Jinghui Hu Date: Tue, 22 Aug 2023 08:36:36 +0800 Subject: [PATCH 08/27] add --- Cargo.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 91128e3..7bf3465 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1056,7 +1056,7 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "leetcode-cli" -version = "0.5.0" +version = "0.5.2" dependencies = [ "anyhow", "async-trait", From d2de6db3eafeec46cef4445c3ecac7291594d8b5 Mon Sep 17 00:00:00 2001 From: Jinghui Hu Date: Tue, 22 Aug 2023 08:37:29 +0800 Subject: [PATCH 09/27] add --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7bf3465..cfd2606 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1056,7 +1056,7 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "leetcode-cli" -version = "0.5.2" +version = "0.5.4" dependencies = [ "anyhow", "async-trait", diff --git a/Cargo.toml b/Cargo.toml index a1d7086..bb842ba 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ path = "src/bin/lc.rs" [package] name = "leetcode-cli" -version = "0.5.2" +version = "0.5.4" authors = ["clearloop "] edition = "2021" description = "Leetcode command-line interface in rust." From e45f25de6f9c689d1668fcae3fd5d43a41fb94f4 Mon Sep 17 00:00:00 2001 From: Jinghui Hu Date: Tue, 22 Aug 2023 08:39:43 +0800 Subject: [PATCH 10/27] fix --- src/config/code.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/config/code.rs b/src/config/code.rs index 5a65cb1..b56f438 100644 --- a/src/config/code.rs +++ b/src/config/code.rs @@ -2,11 +2,11 @@ use serde::{Deserialize, Serialize}; fn default_pick() -> String { - "${fid}.${slug}".into() + "${fid}_${slug}".into() } fn default_submission() -> String { - "${fid}.${slug}.${sid}.${ac}".into() + "${fid}_${slug}.${sid}.${ac}".into() } /// Code config @@ -48,7 +48,7 @@ impl Default for Code { test: true, lang: "rust".into(), pick: "${fid}_${slug}".into(), - submission: "${fid}.${slug}.${sid}.${ac}".into(), + submission: "${fid}_${slug}.${sid}.${ac}".into(), } } } From 7c5de6a79225f1d3d57265e437a6830279bbd503 Mon Sep 17 00:00:00 2001 From: Jinghui Hu Date: Tue, 22 Aug 2023 08:41:21 +0800 Subject: [PATCH 11/27] add --- src/config/code.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/config/code.rs b/src/config/code.rs index b56f438..0ea778a 100644 --- a/src/config/code.rs +++ b/src/config/code.rs @@ -2,11 +2,11 @@ use serde::{Deserialize, Serialize}; fn default_pick() -> String { - "${fid}_${slug}".into() + "${fid}-${slug}".into() } fn default_submission() -> String { - "${fid}_${slug}.${sid}.${ac}".into() + "${fid}-${slug}.${sid}.${ac}".into() } /// Code config @@ -48,7 +48,7 @@ impl Default for Code { test: true, lang: "rust".into(), pick: "${fid}_${slug}".into(), - submission: "${fid}_${slug}.${sid}.${ac}".into(), + submission: "${fid}-${slug}.${sid}.${ac}".into(), } } } From 78f8a95555a845d567bad8d25e5875bf5bf0ee44 Mon Sep 17 00:00:00 2001 From: Jinghui Hu Date: Tue, 22 Aug 2023 08:43:47 +0800 Subject: [PATCH 12/27] add --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cfd2606..7127ac0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1056,7 +1056,7 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "leetcode-cli" -version = "0.5.4" +version = "0.5.5" dependencies = [ "anyhow", "async-trait", diff --git a/Cargo.toml b/Cargo.toml index bb842ba..b925281 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ path = "src/bin/lc.rs" [package] name = "leetcode-cli" -version = "0.5.4" +version = "0.5.5" authors = ["clearloop "] edition = "2021" description = "Leetcode command-line interface in rust." From 0263870268f479d8e2a6c6cf80dbf358d608de7c Mon Sep 17 00:00:00 2001 From: Jinghui Hu Date: Tue, 22 Aug 2023 09:17:30 +0800 Subject: [PATCH 13/27] update domain --- src/config/sys.rs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/config/sys.rs b/src/config/sys.rs index 8d6145b..2ddc2af 100644 --- a/src/config/sys.rs +++ b/src/config/sys.rs @@ -33,20 +33,20 @@ pub struct Urls { impl Default for Urls { fn default() -> Self { Self { - base: "https://leetcode.cn".into(), - graphql: "https://leetcode.cn/graphql".into(), - login: "https://leetcode.cn/accounts/login/".into(), - problems: "https://leetcode.cn/api/problems/$category/".into(), - problem: "https://leetcode.cn/problems/$slug/description/".into(), - tag: "https://leetcode.cn/tag/$slug/".into(), - test: "https://leetcode.cn/problems/$slug/interpret_solution/".into(), - session: "https://leetcode.cn/session/".into(), - submit: "https://leetcode.cn/problems/$slug/submit/".into(), - submissions: "https://leetcode.cn/submissions/detail/$id/".into(), - submission: "https://leetcode.cn/submissions/detail/$id/".into(), - verify: "https://leetcode.cn/submissions/detail/$id/check/".into(), - favorites: "https://leetcode.cn/list/api/questions".into(), - favorite_delete: "https://leetcode.cn/list/api/questions/$hash/$id".into(), + base: "https://leetcode-cn.com".into(), + graphql: "https://leetcode-cn.com/graphql".into(), + login: "https://leetcode-cn.com/accounts/login/".into(), + problems: "https://leetcode-cn.com/api/problems/$category/".into(), + problem: "https://leetcode-cn.com/problems/$slug/description/".into(), + tag: "https://leetcode-cn.com/tag/$slug/".into(), + test: "https://leetcode-cn.com/problems/$slug/interpret_solution/".into(), + session: "https://leetcode-cn.com/session/".into(), + submit: "https://leetcode-cn.com/problems/$slug/submit/".into(), + submissions: "https://leetcode-cn.com/submissions/detail/$id/".into(), + submission: "https://leetcode-cn.com/submissions/detail/$id/".into(), + verify: "https://leetcode-cn.com/submissions/detail/$id/check/".into(), + favorites: "https://leetcode-cn.com/list/api/questions".into(), + favorite_delete: "https://leetcode-cn.com/list/api/questions/$hash/$id".into(), } } } From 85c4252470d5ee4ea19998d864a1761a3edb62da Mon Sep 17 00:00:00 2001 From: Jinghui Hu Date: Tue, 22 Aug 2023 09:25:25 +0800 Subject: [PATCH 14/27] add --- src/config/sys.rs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/config/sys.rs b/src/config/sys.rs index 2ddc2af..8d6145b 100644 --- a/src/config/sys.rs +++ b/src/config/sys.rs @@ -33,20 +33,20 @@ pub struct Urls { impl Default for Urls { fn default() -> Self { Self { - base: "https://leetcode-cn.com".into(), - graphql: "https://leetcode-cn.com/graphql".into(), - login: "https://leetcode-cn.com/accounts/login/".into(), - problems: "https://leetcode-cn.com/api/problems/$category/".into(), - problem: "https://leetcode-cn.com/problems/$slug/description/".into(), - tag: "https://leetcode-cn.com/tag/$slug/".into(), - test: "https://leetcode-cn.com/problems/$slug/interpret_solution/".into(), - session: "https://leetcode-cn.com/session/".into(), - submit: "https://leetcode-cn.com/problems/$slug/submit/".into(), - submissions: "https://leetcode-cn.com/submissions/detail/$id/".into(), - submission: "https://leetcode-cn.com/submissions/detail/$id/".into(), - verify: "https://leetcode-cn.com/submissions/detail/$id/check/".into(), - favorites: "https://leetcode-cn.com/list/api/questions".into(), - favorite_delete: "https://leetcode-cn.com/list/api/questions/$hash/$id".into(), + base: "https://leetcode.cn".into(), + graphql: "https://leetcode.cn/graphql".into(), + login: "https://leetcode.cn/accounts/login/".into(), + problems: "https://leetcode.cn/api/problems/$category/".into(), + problem: "https://leetcode.cn/problems/$slug/description/".into(), + tag: "https://leetcode.cn/tag/$slug/".into(), + test: "https://leetcode.cn/problems/$slug/interpret_solution/".into(), + session: "https://leetcode.cn/session/".into(), + submit: "https://leetcode.cn/problems/$slug/submit/".into(), + submissions: "https://leetcode.cn/submissions/detail/$id/".into(), + submission: "https://leetcode.cn/submissions/detail/$id/".into(), + verify: "https://leetcode.cn/submissions/detail/$id/check/".into(), + favorites: "https://leetcode.cn/list/api/questions".into(), + favorite_delete: "https://leetcode.cn/list/api/questions/$hash/$id".into(), } } } From 238fb3320d36bb2b4d234f3858f23bc793c78aa1 Mon Sep 17 00:00:00 2001 From: Jinghui Hu Date: Tue, 22 Aug 2023 09:29:43 +0800 Subject: [PATCH 15/27] fix: get problem from US site --- src/config/sys.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/config/sys.rs b/src/config/sys.rs index 8d6145b..5c8f0cf 100644 --- a/src/config/sys.rs +++ b/src/config/sys.rs @@ -36,8 +36,8 @@ impl Default for Urls { base: "https://leetcode.cn".into(), graphql: "https://leetcode.cn/graphql".into(), login: "https://leetcode.cn/accounts/login/".into(), - problems: "https://leetcode.cn/api/problems/$category/".into(), - problem: "https://leetcode.cn/problems/$slug/description/".into(), + problems: "https://leetcode.com/api/problems/$category/".into(), + problem: "https://leetcode.com/problems/$slug/description/".into(), tag: "https://leetcode.cn/tag/$slug/".into(), test: "https://leetcode.cn/problems/$slug/interpret_solution/".into(), session: "https://leetcode.cn/session/".into(), From b62f4bf718099d30b30c0118fc2a296de84dfaef Mon Sep 17 00:00:00 2001 From: Jinghui Hu Date: Tue, 22 Aug 2023 09:30:16 +0800 Subject: [PATCH 16/27] add --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7127ac0..94a5501 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1056,7 +1056,7 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "leetcode-cli" -version = "0.5.5" +version = "0.5.6" dependencies = [ "anyhow", "async-trait", diff --git a/Cargo.toml b/Cargo.toml index b925281..da4d452 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ path = "src/bin/lc.rs" [package] name = "leetcode-cli" -version = "0.5.5" +version = "0.5.6" authors = ["clearloop "] edition = "2021" description = "Leetcode command-line interface in rust." From d915c879df6dd72274909b5ea1f3b547234b835e Mon Sep 17 00:00:00 2001 From: Jinghui Hu Date: Tue, 22 Aug 2023 12:11:34 +0800 Subject: [PATCH 17/27] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=BA=E4=B8=8B?= =?UTF-8?q?=E5=88=92=E7=BA=BF=E5=91=BD=E5=90=8D=E9=A3=8E=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/cache/models.rs | 4 ++++ src/config/code.rs | 6 +++--- src/helper.rs | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/cache/models.rs b/src/cache/models.rs index 107d82c..b066af0 100644 --- a/src/cache/models.rs +++ b/src/cache/models.rs @@ -53,6 +53,10 @@ impl Problem { pub fn get_fid(&self) -> String { format!("s{:0>4}", self.fid) } + + pub fn get_slug(&self) -> String { + self.slug.replace("-", "_").to_string() + } } static DONE: &str = " ✔"; diff --git a/src/config/code.rs b/src/config/code.rs index 0ea778a..b56f438 100644 --- a/src/config/code.rs +++ b/src/config/code.rs @@ -2,11 +2,11 @@ use serde::{Deserialize, Serialize}; fn default_pick() -> String { - "${fid}-${slug}".into() + "${fid}_${slug}".into() } fn default_submission() -> String { - "${fid}-${slug}.${sid}.${ac}".into() + "${fid}_${slug}.${sid}.${ac}".into() } /// Code config @@ -48,7 +48,7 @@ impl Default for Code { test: true, lang: "rust".into(), pick: "${fid}_${slug}".into(), - submission: "${fid}-${slug}.${sid}.${ac}".into(), + submission: "${fid}_${slug}.${sid}.${ac}".into(), } } } diff --git a/src/helper.rs b/src/helper.rs index 51c31e2..a1b4d63 100644 --- a/src/helper.rs +++ b/src/helper.rs @@ -196,7 +196,7 @@ mod file { let mut path = format!("{}/{}.tests.dat", conf.storage.code()?, conf.code.pick); path = path.replace("${fid}", &problem.get_fid()); - path = path.replace("${slug}", &problem.slug.to_string()); + path = path.replace("${slug}", &problem.get_slug()); Ok(path) } @@ -216,7 +216,7 @@ mod file { ); path = path.replace("${fid}", &problem.get_fid()); - path = path.replace("${slug}", &problem.slug.to_string()); + path = path.replace("${slug}", &problem.get_slug()); Ok(path) } From ac932edb50c4e9b5e9ee4d51e5a522b8c849ec61 Mon Sep 17 00:00:00 2001 From: Jinghui Hu Date: Tue, 22 Aug 2023 12:13:32 +0800 Subject: [PATCH 18/27] v0.6.0 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index da4d452..cdda882 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ path = "src/bin/lc.rs" [package] name = "leetcode-cli" -version = "0.5.6" +version = "0.6.0" authors = ["clearloop "] edition = "2021" description = "Leetcode command-line interface in rust." From 8bffdf68505afc7cc6001c600b3b24a713af4654 Mon Sep 17 00:00:00 2001 From: Jinghui Hu Date: Tue, 22 Aug 2023 14:37:05 +0800 Subject: [PATCH 19/27] v0.5.7 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index cdda882..4d7e3bd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ path = "src/bin/lc.rs" [package] name = "leetcode-cli" -version = "0.6.0" +version = "0.5.7" authors = ["clearloop "] edition = "2021" description = "Leetcode command-line interface in rust." From 2bd5e2461d72ead7afbd92ee60ed002959225b71 Mon Sep 17 00:00:00 2001 From: Jinghui Hu Date: Tue, 22 Aug 2023 14:37:38 +0800 Subject: [PATCH 20/27] timestamp: 2023-08-22 14:37:38 --- Cargo.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 94a5501..efe1ea9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1056,7 +1056,7 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "leetcode-cli" -version = "0.5.6" +version = "0.5.7" dependencies = [ "anyhow", "async-trait", From a93fae6bf81f0fb281ac438290174b2e9b2b4b29 Mon Sep 17 00:00:00 2001 From: Jinghui Hu Date: Tue, 22 Aug 2023 14:37:42 +0800 Subject: [PATCH 21/27] v0.6.0 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 4d7e3bd..cdda882 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ path = "src/bin/lc.rs" [package] name = "leetcode-cli" -version = "0.5.7" +version = "0.6.0" authors = ["clearloop "] edition = "2021" description = "Leetcode command-line interface in rust." From f5fa247159091b995b55f4657ee5cbbbbcff66a9 Mon Sep 17 00:00:00 2001 From: Jinghui Hu Date: Tue, 22 Aug 2023 14:38:28 +0800 Subject: [PATCH 22/27] timestamp: 2023-08-22 14:38:28 --- Cargo.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index efe1ea9..0819a93 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1056,7 +1056,7 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "leetcode-cli" -version = "0.5.7" +version = "0.6.0" dependencies = [ "anyhow", "async-trait", From 2413966b9ade92a5e4b571bb9bea3ede5004756f Mon Sep 17 00:00:00 2001 From: Jinghui Hu Date: Tue, 22 Aug 2023 14:39:10 +0800 Subject: [PATCH 23/27] v0.6.1 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index cdda882..2c1525c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ path = "src/bin/lc.rs" [package] name = "leetcode-cli" -version = "0.6.0" +version = "0.6.1" authors = ["clearloop "] edition = "2021" description = "Leetcode command-line interface in rust." From c86e79ecfd70d80bc54bf38e9d6e10c5187d6ddf Mon Sep 17 00:00:00 2001 From: Jinghui Hu Date: Tue, 22 Aug 2023 14:39:35 +0800 Subject: [PATCH 24/27] add --- Cargo.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 0819a93..d006fb7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1056,7 +1056,7 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "leetcode-cli" -version = "0.6.0" +version = "0.6.1" dependencies = [ "anyhow", "async-trait", From 4a6dfd0916b949bde54c8a6ab7b944884cb1e83e Mon Sep 17 00:00:00 2001 From: Jinghui Hu Date: Wed, 23 Aug 2023 03:17:52 +0800 Subject: [PATCH 25/27] feat: path ~ for code config --- src/config/storage.rs | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/config/storage.rs b/src/config/storage.rs index 72a01fc..38f2946 100644 --- a/src/config/storage.rs +++ b/src/config/storage.rs @@ -49,11 +49,22 @@ impl Storage { /// get code path pub fn code(&self) -> Result { - let root = &self.root()?; - let p = PathBuf::from(root).join(&self.code); - if !PathBuf::from(&p).exists() { - fs::create_dir(&p)? - } + let home = dirs::home_dir() + .ok_or(Error::NoneError)? + .to_string_lossy() + .to_string(); + let path = self.code.replace('~', &home); + + let p = if !path.starts_with("/") { + let root = &self.root()?; + let abs_path = PathBuf::from(root).join(&path); + if !PathBuf::from(&abs_path).exists() { + fs::create_dir(&abs_path)? + }; + abs_path + } else { + PathBuf::from(path) + }; Ok(p.to_string_lossy().to_string()) } From 6a89361c0efb93011a7d6021a4ac8ed23ad37bbf Mon Sep 17 00:00:00 2001 From: Jinghui Hu Date: Wed, 23 Aug 2023 03:20:24 +0800 Subject: [PATCH 26/27] v0.6.2 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 2c1525c..6d41fa7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ path = "src/bin/lc.rs" [package] name = "leetcode-cli" -version = "0.6.1" +version = "0.6.2" authors = ["clearloop "] edition = "2021" description = "Leetcode command-line interface in rust." From aedff6a6eaf56b63b198042bcbc4839f27bd6284 Mon Sep 17 00:00:00 2001 From: Jinghui Hu Date: Wed, 23 Aug 2023 03:20:38 +0800 Subject: [PATCH 27/27] timestamp: 2023-08-23 03:20:38 --- Cargo.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index d006fb7..64cd504 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1056,7 +1056,7 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "leetcode-cli" -version = "0.6.1" +version = "0.6.2" dependencies = [ "anyhow", "async-trait", pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy