pesde/src/cli/commands/update.rs
Luka a41d9950f8
Some checks are pending
Debug / Get build version (push) Waiting to run
Debug / Build for linux-x86_64 (push) Blocked by required conditions
Debug / Build for macos-aarch64 (push) Blocked by required conditions
Debug / Build for macos-x86_64 (push) Blocked by required conditions
Debug / Build for windows-x86_64 (push) Blocked by required conditions
Test & Lint / lint (push) Waiting to run
feat: better install (#17)
* feat: better install

* feat: support progress reporting for wally

* chore: remove tracing-indicatif

* chore: fix Cargo.toml

* fix: indentation in bin link script

* fix: spinner tick chars

* feat: change progress message color

* fix: remove pretty from fmt_layer

Co-authored-by: dai <72147841+daimond113@users.noreply.github.com>

* style: format code

---------

Co-authored-by: dai <72147841+daimond113@users.noreply.github.com>
2024-12-27 22:04:47 +01:00

43 lines
1.1 KiB
Rust

use crate::cli::{
install::{install, InstallOptions},
run_on_workspace_members,
};
use clap::Args;
use pesde::Project;
use std::num::NonZeroUsize;
#[derive(Debug, Args, Copy, Clone)]
pub struct UpdateCommand {
/// Update the dependencies but don't install them
#[arg(long)]
no_install: bool,
/// The maximum number of concurrent network requests
#[arg(long, default_value = "16")]
network_concurrency: NonZeroUsize,
}
impl UpdateCommand {
pub async fn run(self, project: Project, reqwest: reqwest::Client) -> anyhow::Result<()> {
let options = InstallOptions {
locked: false,
prod: false,
write: !self.no_install,
network_concurrency: self.network_concurrency,
use_lockfile: false,
};
install(&options, &project, reqwest.clone(), true).await?;
run_on_workspace_members(&project, |project| {
let reqwest = reqwest.clone();
async move {
install(&options, &project, reqwest, false).await?;
Ok(())
}
})
.await?;
Ok(())
}
}