Make the public/no-public next to the pair optional/no-optional

This commit is contained in:
Lin Yihai 2023-11-27 07:26:55 +08:00
parent 58e0ab825b
commit 509535675b
3 changed files with 27 additions and 28 deletions

View File

@ -62,6 +62,17 @@ The package name will be exposed as feature of your crate.")
The package will be removed from your features.")
.conflicts_with("dev")
.overrides_with("optional"),
flag("public", "Mark the dependency as public")
.long_help("Mark the dependency as public
The dependnecy will be visible in both of your crate and outside."),
flag("no-public", "Mark the dependency as private")
.conflicts_with("dev")
.conflicts_with("build")
.overrides_with("public")
.long_help("Mark the dependency as private
The dependnecy will be only visible in your crate other than outside."),
clap::Arg::new("rename")
.long("rename")
.action(ArgAction::Set)
@ -76,18 +87,6 @@ Example uses:
"ignore-rust-version",
"Ignore `rust-version` specification in packages (unstable)"
),
flag("public", "Mark the dependency as public")
.long_help("Mark the dependency as public
The dependnecy will be visible in both of your crate and outside."),
flag("no-public", "Mark the dependency as private")
.conflicts_with("dev")
.long_help("Mark the dependency as private
The dependnecy will be only visible in your crate other than outside.")
.conflicts_with("dev")
.overrides_with("public"),
])
.arg_manifest_path_without_unsupported_path_tip()
.arg_package("Package to modify")

View File

@ -51,13 +51,13 @@ impl Dependency {
Self {
name: name.into(),
optional: None,
public: None,
features: None,
default_features: None,
inherited_features: None,
source: None,
registry: None,
rename: None,
public: None,
}
}
@ -338,14 +338,14 @@ impl Dependency {
let dep = Self {
name,
rename,
source: Some(source),
registry,
default_features,
features,
optional,
public,
features,
default_features,
inherited_features: None,
source: Some(source),
registry,
rename,
};
Ok(dep)
} else {

View File

@ -32,16 +32,6 @@ Options:
The package will be removed from your features.
--rename <NAME>
Rename the dependency
Example uses:
- Depending on multiple versions of a crate
- Depend on crates with the same name from different registries
--ignore-rust-version
Ignore `rust-version` specification in packages (unstable)
--public
Mark the dependency as public
@ -52,6 +42,16 @@ Options:
The dependnecy will be only visible in your crate other than outside.
--rename <NAME>
Rename the dependency
Example uses:
- Depending on multiple versions of a crate
- Depend on crates with the same name from different registries
--ignore-rust-version
Ignore `rust-version` specification in packages (unstable)
-n, --dry-run
Don't actually write the manifest