-
Notifications
You must be signed in to change notification settings - Fork 331
Expand file tree
/
Copy pathfetch.rs
More file actions
25 lines (20 loc) · 754 Bytes
/
fetch.rs
File metadata and controls
25 lines (20 loc) · 754 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use volta_core::error::{ExitCode, Fallible};
use volta_core::session::{ActivityKind, Session};
use volta_core::tool;
use crate::command::Command;
#[derive(clap::Args)]
pub(crate) struct Fetch {
/// Tools to fetch, like `node@nightly`, `yarn@latest` or `your-package@^14.4.3`.
#[arg(value_name = "tool[@version]", required = true)]
tools: Vec<String>,
}
impl Command for Fetch {
fn run(self, session: &mut Session) -> Fallible<ExitCode> {
session.add_event_start(ActivityKind::Fetch);
for tool in tool::Spec::from_strings(&self.tools, "fetch")? {
tool.resolve(session)?.fetch(session)?;
}
session.add_event_end(ActivityKind::Fetch, ExitCode::Success);
Ok(ExitCode::Success)
}
}