-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
112 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
use crate::check_update; | ||
|
||
use super::*; | ||
use serde_json::json; | ||
|
||
/// Test the update check | ||
#[derive(Parser)] | ||
pub struct Args {} | ||
|
||
pub async fn command(_args: Args, json: bool) -> Result<()> { | ||
let mut configs = Configs::new()?; | ||
|
||
if json { | ||
let result = configs.check_update(true).await; | ||
|
||
if let Ok(Some(latest_version)) = result { | ||
let json = json!({ | ||
"latest_version": latest_version, | ||
"current_version": env!("CARGO_PKG_VERSION"), | ||
}); | ||
println!("{}", serde_json::to_string_pretty(&json)?); | ||
} else { | ||
let json = json!({ | ||
"latest_version": None::<String>, | ||
"current_version": env!("CARGO_PKG_VERSION"), | ||
}); | ||
println!("{}", serde_json::to_string_pretty(&json)?); | ||
} | ||
return Ok(()); | ||
} | ||
|
||
check_update!(configs, true); | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,3 +29,5 @@ pub mod up; | |
pub mod variables; | ||
pub mod volume; | ||
pub mod whoami; | ||
|
||
pub mod check_updates; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,7 +58,8 @@ commands_enum!( | |
variables, | ||
whoami, | ||
volume, | ||
redeploy | ||
redeploy, | ||
check_updates | ||
); | ||
|
||
#[tokio::main] | ||
|