remote-update - #200
remote-update#200coladonz wants to merge 2 commits into
Conversation
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
| serde = { version = "1.0", features = ["derive"] } | ||
| serde_json = { version = "1.0" } | ||
| tiny-keccak = { version = "1.4" } | ||
| reqwest = { version = "0.10.6", features = ["json"] } |
There was a problem hiding this comment.
nit: please order the imports alphabetically
|
|
||
| #[cfg_attr(tarpaulin, skip)] | ||
| pub mod cli; | ||
| pub mod remote_update; No newline at end of file |
| EthereumCLI::new(), | ||
| MoneroCLI::new(), | ||
| ZcashCLI::new(), | ||
| SubCommand::with_name("update").about("Auto update to latest version"), |
There was a problem hiding this comment.
nit: can you change the description to read Update wagyu to the latest version?
There was a problem hiding this comment.
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.
| Ok(_) => println!("Update finished."), | ||
| Err(err) => println!("{}\nUpdate failed.", err) | ||
| } | ||
| } No newline at end of file |
| println!("You are using the latest version."); | ||
| } | ||
| } | ||
| Err(_) => println!("Please check the internet connection for the automatic version update.") |
There was a problem hiding this comment.
Change this to read You are in offline mode.
| use tokio::runtime::Runtime; | ||
| use reqwest; | ||
| use serde_json; | ||
| use serde_json::Value; | ||
| use self_update; | ||
|
|
||
| use clap::{crate_version}; |
There was a problem hiding this comment.
| 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; |
| println!("New version {} available.", version); | ||
| return version; | ||
| } else { | ||
| println!("You are using the latest version."); |
There was a problem hiding this comment.
Change this to read You are on the latest version.
| .set_term_width(0) | ||
| .get_matches(); | ||
|
|
||
| let latest_version = remote_update::version_check(); |
There was a problem hiding this comment.
This should be implemented as part of a UpdateCLI::version_check()
| ("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(_)) => { |
There was a problem hiding this comment.
This should adhere to the same *CLI parse and print convention
wagyuis called, it checks for updates.wagyuis 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.wagyu updateis called, it fetches the latest release if it's outdated.