Skip to content

Commit 1abaa88

Browse files
committed
feat: add lockfile-path flag for all requested commands
- All commands that support `manifest-path` (except `locate-project`, `verify-project` and `read-manifest`)
1 parent dc1519d commit 1abaa88

23 files changed

+243
-112
lines changed

src/bin/cargo/commands/add.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ Example uses:
8787
- Depend on crates with the same name from different registries"),
8888
])
8989
.arg_manifest_path_without_unsupported_path_tip()
90+
.arg_lockfile_path()
9091
.arg_package("Package to modify")
9192
.arg_ignore_rust_version()
9293
.arg_dry_run("Don't actually write the manifest")

src/bin/cargo/commands/bench.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ pub fn cli() -> Command {
5050
.arg_unit_graph()
5151
.arg_timings()
5252
.arg_manifest_path()
53+
.arg_lockfile_path()
5354
.arg_ignore_rust_version()
5455
.after_help(color_print::cstr!(
5556
"Run `<cyan,bold>cargo help bench</>` for more detailed information.\n"

src/bin/cargo/commands/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ pub fn cli() -> Command {
3939
.arg_unit_graph()
4040
.arg_timings()
4141
.arg_manifest_path()
42+
.arg_lockfile_path()
4243
.arg_ignore_rust_version()
4344
.after_help(color_print::cstr!(
4445
"Run `<cyan,bold>cargo help build</>` for more detailed information.\n"

src/bin/cargo/commands/check.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ pub fn cli() -> Command {
3636
.arg_unit_graph()
3737
.arg_timings()
3838
.arg_manifest_path()
39+
.arg_lockfile_path()
3940
.arg_ignore_rust_version()
4041
.after_help(color_print::cstr!(
4142
"Run `<cyan,bold>cargo help check</>` for more detailed information.\n"

src/bin/cargo/commands/clean.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ pub fn cli() -> Command {
1919
.arg_target_triple("Target triple to clean output for")
2020
.arg_target_dir()
2121
.arg_manifest_path()
22+
.arg_lockfile_path()
2223
.arg_dry_run("Display what would be deleted without deleting anything")
2324
.args_conflicts_with_subcommands(true)
2425
.subcommand(

src/bin/cargo/commands/doc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ pub fn cli() -> Command {
3939
.arg_unit_graph()
4040
.arg_timings()
4141
.arg_manifest_path()
42+
.arg_lockfile_path()
4243
.arg_ignore_rust_version()
4344
.after_help(color_print::cstr!(
4445
"Run `<cyan,bold>cargo help doc</>` for more detailed information.\n"

src/bin/cargo/commands/fetch.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ pub fn cli() -> Command {
99
.arg_silent_suggestion()
1010
.arg_target_triple("Fetch dependencies for the target triple")
1111
.arg_manifest_path()
12+
.arg_lockfile_path()
1213
.after_help(color_print::cstr!(
1314
"Run `<cyan,bold>cargo help fetch</>` for more detailed information.\n"
1415
))

src/bin/cargo/commands/fix.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use crate::command_prelude::*;
22

3-
use cargo::core::Workspace;
43
use cargo::ops;
54

65
pub fn cli() -> Command {
@@ -54,6 +53,7 @@ pub fn cli() -> Command {
5453
.arg_target_dir()
5554
.arg_timings()
5655
.arg_manifest_path()
56+
.arg_lockfile_path()
5757
.arg_ignore_rust_version()
5858
.after_help(color_print::cstr!(
5959
"Run `<cyan,bold>cargo help fix</>` for more detailed information.\n"
@@ -71,8 +71,7 @@ pub fn exec(gctx: &mut GlobalContext, args: &ArgMatches) -> CliResult {
7171
// Unlike other commands default `cargo fix` to all targets to fix as much
7272
// code as we can.
7373
let root_manifest = args.root_manifest(gctx)?;
74-
let mut ws = Workspace::new(&root_manifest, gctx)?;
75-
ws.set_resolve_honors_rust_version(args.honor_rust_version());
74+
let ws = args.workspace(gctx)?;
7675
let mut opts = args.compile_options(gctx, mode, Some(&ws), ProfileChecking::LegacyTestOnly)?;
7776

7877
if !opts.filter.is_specific() {

src/bin/cargo/commands/generate_lockfile.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ pub fn cli() -> Command {
77
.about("Generate the lockfile for a package")
88
.arg_silent_suggestion()
99
.arg_manifest_path()
10+
.arg_lockfile_path()
1011
.arg_ignore_rust_version_with_help(
1112
"Ignore `rust-version` specification in packages (unstable)",
1213
)

src/bin/cargo/commands/package.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ pub fn cli() -> Command {
3737
.arg_target_dir()
3838
.arg_parallel()
3939
.arg_manifest_path()
40+
.arg_lockfile_path()
4041
.after_help(color_print::cstr!(
4142
"Run `<cyan,bold>cargo help package</>` for more detailed information.\n"
4243
))

0 commit comments

Comments
 (0)