solar_core/subcommand/
update.rs1use std::path::{Path, PathBuf};
2
3use clap::Parser;
4
5use crate::{Action, Config, SolarError, ToolTrait};
6
7#[derive(Parser, Clone)]
8pub struct Update {
9 #[arg(short, long, default_value = ".")]
11 destination: PathBuf,
12}
13
14impl Update {
15 pub fn run(&mut self) -> Result<(), SolarError> {
16 solar_update(
17 &mut Config::load_from(&self.destination)?,
18 &self.destination,
19 )
20 }
21}
22
23pub fn solar_update(config: &mut Config, destination: &Path) -> Result<(), SolarError> {
24 config.act(&Action::UPGRADE, Some(destination))
25}