From: Aleksey Kladov Date: Wed, 7 Mar 2018 08:32:10 +0000 (+0300) Subject: Move fetch to clap X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~2^2~47^2~63 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=54527635ce96237874b60b475855093defc45065;p=cargo.git Move fetch to clap --- diff --git a/src/bin/cargo.rs b/src/bin/cargo.rs index ed84f0ed2..f938572f2 100644 --- a/src/bin/cargo.rs +++ b/src/bin/cargo.rs @@ -89,7 +89,7 @@ fn main() { }; let is_clapified = ::std::env::args().any(|arg| match arg.as_ref() { - "build" | "bench" | "check" | "clean" | "doc" => true, + "build" | "bench" | "check" | "clean" | "doc" | "fetch" => true, _ => false }); @@ -122,7 +122,7 @@ macro_rules! each_subcommand{ // $mac!(check); // $mac!(clean); // $mac!(doc); - $mac!(fetch); +// $mac!(fetch); $mac!(generate_lockfile); $mac!(git_checkout); $mac!(help); diff --git a/src/bin/cli/fetch.rs b/src/bin/cli/fetch.rs new file mode 100644 index 000000000..068237ec6 --- /dev/null +++ b/src/bin/cli/fetch.rs @@ -0,0 +1,21 @@ +use super::utils::*; + +pub fn cli() -> App { + subcommand("fetch") + .about("Fetch dependencies of a package from the network") + .arg( + opt("open", "Opens the docs in a browser after the operation") + ) + .arg_manifest_path() + .arg_locked() + .after_help("\ +If a lockfile is available, this command will ensure that all of the git +dependencies and/or registries dependencies are downloaded and locally +available. The network is never touched after a `cargo fetch` unless +the lockfile changes. + +If the lockfile is not available, then this is the equivalent of +`cargo generate-lockfile`. A lockfile is generated and dependencies are also +all updated. +") +} diff --git a/src/bin/cli/mod.rs b/src/bin/cli/mod.rs index 9cf8e95b5..f1465ab13 100644 --- a/src/bin/cli/mod.rs +++ b/src/bin/cli/mod.rs @@ -182,6 +182,12 @@ pub fn do_main(config: &mut Config) -> Result<(), CliError> { ops::doc(&ws, &doc_opts)?; return Ok(()); } + ("fetch", Some(args)) => { + config_from_args(config, args)?; + let ws = workspace_from_args(config, args)?; + ops::fetch(&ws)?; + return Ok(()); + } _ => return Ok(()) } } @@ -249,6 +255,7 @@ See 'cargo help ' for more information on a specific command. check::cli(), clean::cli(), doc::cli(), + fetch::cli(), ]) ; app @@ -259,6 +266,7 @@ mod build; mod check; mod clean; mod doc; +mod fetch; mod utils { use clap::{self, SubCommand, AppSettings};