Skip to content

Commit 7fd192d

Browse files
authored
Merge pull request #17 from rage/force-update
Added flag to force auto update to trigger
2 parents 65613b4 + f582571 commit 7fd192d

3 files changed

Lines changed: 9 additions & 4 deletions

File tree

src/cli.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,12 @@ pub fn build_cli() -> Command<'static> {
9999
.long("no-update")
100100
.help("Disable auto update temporarily"),
101101
)
102+
.arg(
103+
Arg::new("force-update")
104+
.short('u')
105+
.long("force-update")
106+
.help("Force auto update to run"),
107+
)
102108
.arg(
103109
Arg::new("testmode")
104110
.long("testmode")

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ fn run(io: &mut IoProduction, matches: &ArgMatches) -> anyhow::Result<()> {
5454
let os = std::env::consts::OS;
5555
if os == "windows" {
5656
#[cfg(target_os = "windows")]
57-
updater::check_for_update()?;
57+
updater::check_for_update(matches.is_present("force-update"))?;
5858
}
5959
}
6060
_ => println!("No Auto-Updates"),

src/updater.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@ pub const DELAY: u128 = 1440 * 60 * 1000;
2121
/// generates a new timestamp. If a new version is found, the function
2222
/// stashes the old executable and downloads a new one.
2323
/// Will run in privileged stage if needed on Windows!
24-
///
2524
26-
pub fn check_for_update() -> anyhow::Result<()> {
27-
if is_it_time_yet()? {
25+
pub fn check_for_update(force: bool) -> anyhow::Result<()> {
26+
if force || is_it_time_yet()? {
2827
generate_time_stamp()?;
2928
checktemp()?;
3029
let new_ver = get_latest_version()?;

0 commit comments

Comments
 (0)