rustic/src/commands/self_update.rs
2023-04-16 09:53:19 +02:00

25 lines
673 B
Rust

use anyhow::Result;
use clap::Parser;
use self_update::cargo_crate_version;
#[derive(Parser)]
pub(super) struct Opts {
/// Do not ask before processing the self-update
#[clap(long, conflicts_with = "dry_run")]
force: bool,
}
pub(super) fn execute(opts: Opts) -> Result<()> {
let status = self_update::backends::github::Update::configure()
.repo_owner("rustic-rs")
.repo_name("rustic")
.bin_name("rustic")
.show_download_progress(true)
.current_version(cargo_crate_version!())
.no_confirm(opts.force)
.build()?
.update()?;
println!("Update status: `{}`!", status.version());
Ok(())
}