Rm duplicate crate_names specified on cmdline

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-08-02 22:15:09 +10:00
parent 09c1afe616
commit caeb49ce33
No known key found for this signature in database
GPG key ID: 591C0B03040416D6

View file

@ -31,6 +31,9 @@ struct Options {
/// ///
/// When multiple names are provided, the --version option and any override options are /// When multiple names are provided, the --version option and any override options are
/// unavailable due to ambiguity. /// unavailable due to ambiguity.
///
/// If duplicate names are provided, the last one (and their version requirement)
/// is kept.
#[clap(help_heading = "Package selection", value_name = "crate[@version]")] #[clap(help_heading = "Package selection", value_name = "crate[@version]")]
crate_names: Vec<CrateName>, crate_names: Vec<CrateName>,
@ -246,6 +249,9 @@ async fn entry(jobserver_client: LazyJobserverClient) -> Result<()> {
} }
} }
// Remove duplicate crate_name, keep the last one
let crate_names = CrateName::dedup(crate_names);
let cli_overrides = PkgOverride { let cli_overrides = PkgOverride {
pkg_url: opts.pkg_url.take(), pkg_url: opts.pkg_url.take(),
pkg_fmt: opts.pkg_fmt.take(), pkg_fmt: opts.pkg_fmt.take(),