reactive_graph_tooling/tooling/update/
mod.rs1use anyhow::Result;
2use self_update::Status;
3
4use crate::tooling::releases::release_info::print_release_info;
5use crate::tooling::releases::release_info::print_release_list;
6use crate::tooling::releases::update_from_github::update_from_github;
7use crate::tooling::update::args::UpdateArgs;
8use crate::tooling::update::commands::UpdateCommands;
9use crate::tooling::update::repository::REACTIVE_GRAPH_REPOSITORY;
10
11pub mod args;
12pub mod commands;
13pub mod repository;
14
15pub fn handle_update(args: UpdateArgs) -> Result<()> {
16 if let Some(commands) = &args.commands {
17 return match commands {
18 UpdateCommands::Info(release_info_args) => print_release_info(&args.repository, &REACTIVE_GRAPH_REPOSITORY, &args.release, release_info_args),
19 UpdateCommands::List(release_list_args) => print_release_list(&args.repository, &REACTIVE_GRAPH_REPOSITORY, release_list_args),
20 };
21 };
22 let status = execute_update(&args)?;
23 println!("Successfully updated to version: {}", status.version());
24 Ok(())
25}
26
27fn execute_update(args: &UpdateArgs) -> Result<Status> {
28 update_from_github(&args.repository, &REACTIVE_GRAPH_REPOSITORY, &args.release)?
29 .update()
30 .map_err(Into::into)
31}