Specify frozen & locked for all commands simultaneously
authorAleksey Kladov <aleksey.kladov@gmail.com>
Wed, 7 Mar 2018 10:02:35 +0000 (13:02 +0300)
committerAleksey Kladov <aleksey.kladov@gmail.com>
Thu, 8 Mar 2018 20:30:46 +0000 (23:30 +0300)
src/bin/cli/bench.rs
src/bin/cli/build.rs
src/bin/cli/check.rs
src/bin/cli/clean.rs
src/bin/cli/doc.rs
src/bin/cli/fetch.rs
src/bin/cli/generate_lockfile.rs
src/bin/cli/git_checkout.rs
src/bin/cli/init.rs
src/bin/cli/mod.rs

index fa043203202bb4b96113bb2a6e517e6cae044e69..5a84ff317c3486c4d0cad2facc520b7c9a9d20f4 100644 (file)
@@ -45,7 +45,6 @@ pub fn cli() -> App {
         .arg(
             opt("no-fail-fast", "Run all benchmarks regardless of failure")
         )
-        .arg_locked()
         .after_help("\
 All of the trailing arguments are passed to the benchmark binaries generated
 for filtering benchmarks and generally providing options configuring how they
index 9316ca7a99765d9a06147d5501c7767a1be01cd5..9587cb08de068174e809dd080b7d4f89e2f19a59 100644 (file)
@@ -26,7 +26,6 @@ pub fn cli() -> App {
         .arg_target_triple("Build for the target triple")
         .arg_manifest_path()
         .arg_message_format()
-        .arg_locked()
         .after_help("\
 If the --package argument is given, then SPEC is a package id specification
 which indicates which package should be built. If it is not given, then the
index c482fb55ca19fefd8c10e2244bec17b98c282306..b77d7153d0256c45f156017532b0ff16de72f479 100644 (file)
@@ -30,7 +30,6 @@ pub fn cli() -> App {
         .arg_target_triple("Check for the target triple")
         .arg_manifest_path()
         .arg_message_format()
-        .arg_locked()
         .after_help("\
 If the --package argument is given, then SPEC is a package id specification
 which indicates which package should be built. If it is not given, then the
index db494419efe691e72a9d1237a192139b767d488e..eafdb98b69944f57a641deb69ae11eded22662ca 100644 (file)
@@ -10,7 +10,6 @@ pub fn cli() -> App {
         .arg_manifest_path()
         .arg_target_triple("Target triple to clean output for (default all)")
         .arg_release("Whether or not to clean release artifacts")
-        .arg_locked()
         .after_help("\
 If the --package argument is given, then SPEC is a package id specification
 which indicates which package's artifacts should be cleaned out. If it is not
index 7e158c2ed2289df0aee2b4e5c0e2c7701f3ff245..9a567464df7e69f865c5f51dd7081f7e3202d600 100644 (file)
@@ -25,7 +25,6 @@ pub fn cli() -> App {
         .arg_target_triple("Build for the target triple")
         .arg_manifest_path()
         .arg_message_format()
-        .arg_locked()
         .after_help("\
 By default the documentation for the local package and all dependencies is
 built. The output is all placed in `target/doc` in rustdoc's usual format.
index 1a7a0b551fe71475b64228648467f53ada88364f..611a2eb378e6433bedf635cbde6c005c7d40e27a 100644 (file)
@@ -4,7 +4,6 @@ pub fn cli() -> App {
     subcommand("fetch")
         .about("Fetch dependencies of a package from the network")
         .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
index faf0c35e7294c8f6399130736a15dc3234e95e62..438c43f2e15e09890870c936b1fd6c28747f8573 100644 (file)
@@ -4,7 +4,6 @@ pub fn cli() -> App {
     subcommand("generate-lockfile")
         .about("Generate the lockfile for a project")
         .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
index b926db969f3d1e7988d0b29d27ed9fd62692858e..68250b9718c4d9e0cebac0bff71d519de36a5e7b 100644 (file)
@@ -5,5 +5,4 @@ pub fn cli() -> App {
         .about("Checkout a copy of a Git repository")
         .arg(Arg::with_name("url").long("url").value_name("URL").required(true))
         .arg(Arg::with_name("reference").long("reference").value_name("REF").required(true))
-        .arg_locked()
 }
index 74744c461be39f7f5e70557f79fe4fa8189f552a..c0f3182b8683830822af00e4588afd8e49ac55c8 100644 (file)
@@ -24,5 +24,4 @@ a global configuration."
             opt("name", "Set the resulting package name")
                 .value_name("NAME")
         )
-        .arg_locked()
 }
index 2f2a466246612c5314216a73b7002b26ec7cf4cf..00bdacb90d515447f0aaf74eb32f0e451f850de0 100644 (file)
@@ -107,9 +107,9 @@ pub fn do_main(config: &mut Config) -> Result<(), CliError> {
         Ok(opts)
     }
 
+    config_from_args(config, &args)?;
     match args.subcommand() {
         ("bench", Some(args)) => {
-            config_from_args(config, args)?;
             let ws = workspace_from_args(config, args)?;
             let compile_opts = compile_options_from_args(config, args, CompileMode::Bench)?;
 
@@ -136,14 +136,12 @@ pub fn do_main(config: &mut Config) -> Result<(), CliError> {
             };
         }
         ("build", Some(args)) => {
-            config_from_args(config, args)?;
             let ws = workspace_from_args(config, args)?;
             let compile_opts = compile_options_from_args(config, args, CompileMode::Build)?;
             ops::compile(&ws, &compile_opts)?;
             return Ok(());
         }
         ("check", Some(args)) => {
-            config_from_args(config, args)?;
             let ws = workspace_from_args(config, args)?;
             let test = match args.value_of("profile") {
                 Some("test") => true,
@@ -160,7 +158,6 @@ pub fn do_main(config: &mut Config) -> Result<(), CliError> {
             return Ok(());
         }
         ("clean", Some(args)) => {
-            config_from_args(config, args)?;
             let ws = workspace_from_args(config, args)?;
             let opts = ops::CleanOptions {
                 config,
@@ -172,7 +169,6 @@ pub fn do_main(config: &mut Config) -> Result<(), CliError> {
             return Ok(());
         }
         ("doc", Some(args)) => {
-            config_from_args(config, args)?;
             let ws = workspace_from_args(config, args)?;
             let mode = ops::CompileMode::Doc { deps: !args.is_present("no-deps") };
             let compile_opts = compile_options_from_args(config, args, mode)?;
@@ -184,20 +180,16 @@ pub fn do_main(config: &mut Config) -> Result<(), CliError> {
             return Ok(());
         }
         ("fetch", Some(args)) => {
-            config_from_args(config, args)?;
             let ws = workspace_from_args(config, args)?;
             ops::fetch(&ws)?;
             return Ok(());
         }
         ("generate-lockfile", Some(args)) => {
-            config_from_args(config, args)?;
             let ws = workspace_from_args(config, args)?;
             ops::generate_lockfile(&ws)?;
             return Ok(());
         }
         ("git-checkout", Some(args)) => {
-            config_from_args(config, args)?;
-
             let url = args.value_of("url").unwrap().to_url()?;
             let reference = args.value_of("reference").unwrap();
 
@@ -211,8 +203,6 @@ pub fn do_main(config: &mut Config) -> Result<(), CliError> {
             return Ok(());
         }
         ("init", Some(args)) => {
-            config_from_args(config, args)?;
-
             let path = args.value_of("path").unwrap_or(".");
             let vcs = args.value_of("vcs").map(|vcs| match vcs {
                 "git" => VersionControl::Git,
@@ -270,6 +260,14 @@ fn cli() -> App {
             opt("color", "Coloring: auto, always, never")
                 .value_name("WHEN").global(true)
         )
+        .arg(
+            opt("frozen", "Require Cargo.lock and cache are up to date")
+                .global(true)
+        )
+        .arg(
+            opt("locked", "Require Cargo.lock is up to date")
+                .global(true)
+        )
         .arg(
             Arg::with_name("unstable-features").help("Unstable (nightly-only) flags to Cargo")
                 .short("Z").value_name("FLAG").multiple(true).global(true)