Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 706a89d

Browse files
sync new config while change current lang
1 parent d663e8f commit 706a89d

File tree

9 files changed

+14
-14
lines changed

9 files changed

+14
-14
lines changed

‎CHANGELOG.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## v0.2.5
2+
sync config while change current lang
3+
14
## v0.2.5
25
update local cache when submission status changes
36

‎Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ path = "src/bin/lc.rs"
44

55
[package]
66
name = "leetcode-cli"
7-
version = "0.2.5"
7+
version = "0.2.6"
88
authors = ["clearloop <udtrokia@163.com>"]
99
edition = "2018"
1010
description = "Leet your code in command-line."

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ cargo install leetcode-cli
2323
**Please make sure you have logined in `leetcode.com` with `chrome`**, more info plz checkout [this](#cookies)
2424

2525
```sh
26-
leetcode 0.2.3
26+
leetcode 0.2.6
2727
clearloop <udtrokia@163.com>
2828
Here's to the crazy ones 👻
2929

‎examples/pym.rs‎

Lines changed: 0 additions & 5 deletions
This file was deleted.

‎src/cfg.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ impl Config {
8282
/// Sync new config to config.toml
8383
pub fn sync(&self) -> Result<(), crate::Error> {
8484
let home = dirs::home_dir()?;
85-
let conf = home.join(".leetcode/conf.toml");
85+
let conf = home.join(".leetcode/leetcode.toml");
8686
fs::write(conf, toml::ser::to_string_pretty(&self)?)?;
8787

8888
Ok(())

‎src/cli.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use clap::{App, AppSettings};
1313
pub fn main() -> Result<(), Error> {
1414
let m = App::new("leetcode")
1515
.author("clearloop <udtrokia@163.com>")
16-
.version("0.2.5")
16+
.version("0.2.6")
1717
.about("Here's to the crazy ones 👻")
1818
.subcommands(vec![
1919
DataCommand::usage().display_order(1),

‎src/cmds/edit.rs‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,15 @@ impl Command for EditCommand {
5252
let id: i32 = m.value_of("id")?.parse()?;
5353
let cache = Cache::new()?;
5454
let target = cache.get_problem(id)?;
55+
let mut conf = cache.to_owned().0.conf;
5556

5657
// condition language
57-
let mut lang = cache.to_owned().0.conf.code.lang;
5858
if m.is_present("lang") {
59-
lang = m.value_of("lang")?.to_string();
59+
conf.code.lang = m.value_of("lang")?.to_string();
60+
conf.sync()?;
6061
}
6162

63+
let lang = conf.code.lang;
6264
let path = crate::helper::code_path(&target, Some(lang.to_owned()))?;
6365
if !Path::new(&path).exists() {
6466
let mut qr = serde_json::from_str(&target.desc);
@@ -85,7 +87,7 @@ impl Command for EditCommand {
8587
}
8688
}
8789

88-
std::process::Command::new(cache.0.conf.code.editor)
90+
std::process::Command::new(conf.code.editor)
8991
.arg(path)
9092
.status()?;
9193
Ok(())

‎src/lib.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
//! **Please make sure you have logined in `leetcode.com` with `chrome`**, more info plz checkout [this](#cookies)
2424
//!
2525
//! ```sh
26-
//! leetcode 0.2.5
26+
//! leetcode 0.2.6
2727
//! clearloop <udtrokia@163.com>
2828
//! Here's to the crazy ones 👻
2929
//!

‎src/plugins/chrome.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ pub fn cookies() -> Result<Ident, crate::Error> {
6666
.load::<Cookies>(&conn)
6767
.expect("Loading cookies from google chrome failed.");
6868

69-
println!("res {:?}", &res);
69+
debug!("res {:?}", &res);
7070
if res.len() == (0 as usize) {
7171
return Err(crate::Error::CookieError);
7272
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /