Skip to content

remote-update - #200

Open
coladonz wants to merge 2 commits into
masterfrom
remote-update
Open

coladonz wants to merge 2 commits into
masterfrom
remote-update

Conversation

@coladonz

@coladonz coladonz commented Jun 1, 2020

Copy link
Copy Markdown
  • When wagyu is called, it checks for updates.
  • When wagyu is called in an offline setting, it detects if it is offline and doesn't check for an update, and indicates to the user that it is in offline mode.
  • When wagyu update is called, it fetches the latest release if it's outdated.

@codecov

codecov Bot commented Jun 1, 2020 •

Copy link
Copy Markdown

Codecov Report

Merging #200 into master will decrease coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #200      +/-   ##
==========================================
- Coverage   88.07%   88.07%   -0.01%     
==========================================
  Files         110      110              
  Lines        9500     9499       -1     
==========================================
- Hits         8367     8366       -1     
  Misses       1133     1133              
Impacted Files Coverage Δ
monero/src/one_time_key.rs 81.42% <0.00%> (-0.27%) ⬇️
bitcoin/src/transaction.rs 86.57% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 61a1b2e...947cc9a. Read the comment docs.

@coladonz
coladonz requested a review from howardwu June 1, 2020 19:20
Comment thread Cargo.toml Outdated
serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0" }
tiny-keccak = { version = "1.4" }
reqwest = { version = "0.10.6", features = ["json"] }

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: please order the imports alphabetically

Comment thread wagyu/lib.rs Outdated

#[cfg_attr(tarpaulin, skip)]
pub mod cli;
pub mod remote_update; No newline at end of file

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: please add a newline after

Comment thread wagyu/main.rs Outdated
EthereumCLI::new(),
MoneroCLI::new(),
ZcashCLI::new(),
SubCommand::with_name("update").about("Auto update to latest version"),

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can you change the description to read Update wagyu to the latest version?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you formalize this into an UpdateCLI struct, so that the command's functionality is encapsulated under the parse and print model we have defined?

This will enable future extensibility of the update command without introducing complexity outside of the Struct's scope.

Comment thread wagyu/remote_update.rs Outdated
Ok(_) => println!("Update finished."),
Err(err) => println!("{}\nUpdate failed.", err)
}
} No newline at end of file

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: please add a newline

Comment thread wagyu/remote_update.rs Outdated
println!("You are using the latest version.");
}
}
Err(_) => println!("Please check the internet connection for the automatic version update.")

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change this to read You are in offline mode.

Comment thread wagyu/remote_update.rs Outdated
Comment on lines +1 to +7
use tokio::runtime::Runtime;
use reqwest;
use serde_json;
use serde_json::Value;
use self_update;

use clap::{crate_version};

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
use tokio::runtime::Runtime;
use reqwest;
use serde_json;
use serde_json::Value;
use self_update;
use clap::{crate_version};
use clap::{crate_version};
use reqwest;
use self_update;
use serde_json;
use serde_json::Value;
use tokio::runtime::Runtime;

Comment thread wagyu/remote_update.rs Outdated
println!("New version {} available.", version);
return version;
} else {
println!("You are using the latest version.");

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change this to read You are on the latest version.

Comment thread wagyu/main.rs Outdated
.set_term_width(0)
.get_matches();

let latest_version = remote_update::version_check();

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be implemented as part of a UpdateCLI::version_check()

Comment thread wagyu/main.rs Outdated
("ethereum", Some(arguments)) => EthereumCLI::print(EthereumCLI::parse(arguments)?),
("monero", Some(arguments)) => MoneroCLI::print(MoneroCLI::parse(arguments)?),
("zcash", Some(arguments)) => ZcashCLI::print(ZcashCLI::parse(arguments)?),
("update", Some(_)) => {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should adhere to the same *CLI parse and print convention

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants