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
26
27
28
29
30
31
32
33
34
35
36
37
38
use crate::ops::forc_update;
use clap::Parser;
use forc_pkg::source::IPFSNode;
use forc_util::ForcResult;
/// Update dependencies in the Forc dependencies directory.
#[derive(Debug, Parser)]
pub struct Command {
/// Path to the project, if not specified, current working directory will be used.
#[clap(short, long)]
pub path: Option<String>,
/// Dependency to be updated.
/// If not set, all dependencies will be updated.
#[clap(short = 'd')]
pub target_dependency: Option<String>,
/// Checks if the dependencies have newer versions.
/// Won't actually perform the update, will output which
/// ones are up-to-date and outdated.
#[clap(short, long)]
pub check: bool,
/// The IPFS Node to use for fetching IPFS sources.
///
/// Possible values: PUBLIC, LOCAL, <GATEWAY_URL>
#[clap(long)]
pub ipfs_node: Option<IPFSNode>,
}
pub(crate) async fn exec(command: Command) -> ForcResult<()> {
match forc_update::update(command).await {
Ok(_) => Ok(()),
Err(e) => Err(format!("couldn't update dependencies: {}", e)
.as_str()
.into()),
}
}