Skip to content

added the third_party_subcommands function in the cli.rs file #15100

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ibilalkayy
Copy link
Contributor

Hey there,

After grinding for hours, I think I found a place to call the third_party_subcommands function in the cli.rs file and after putting third_party return value inside the CodeCompletion::new(), it gave me the following error:

the trait bound `OsString: From<BTreeMap<std::string::String, cargo::util::command_prelude::CommandInfo>>` is not satisfied
the following other types implement trait `From<T>`:
  `OsString` implements `From<&T>`
  `OsString` implements `From<Box<std::ffi::OsStr>>`
  `OsString` implements `From<Cow<'_, std::ffi::OsStr>>`
  `OsString` implements `From<PathBuf>`
  `OsString` implements `From<clap::builder::OsStr>`
  `OsString` implements `From<clap::builder::Str>`
  `OsString` implements `From<std::string::String>`
required for `BTreeMap<std::string::String, cargo::util::command_prelude::CommandInfo>` to implement `Into<OsString>`rustc[Click for full compiler diagnostic](rust-analyzer-diagnostics-view:/diagnostic%20message%20[0]?0#file:///home/ibilalkayy/Documents/cargo/src/bin/cargo/cli.rs)
cli.rs(586, 18): required by a bound introduced by this call
candidate.rs(19, 28): required by a bound in `CompletionCandidate::new`

After going to the candidate.rs file (that is not present in the cargo repo as I looked through it), I noticed that another fields needs to be added to be implemented in a method that will take arguments and then pass on.

Let me know if I am on the right track and if further improvements need to be added.

Thank you!

@rustbot
Copy link
Collaborator

rustbot commented Jan 24, 2025

r? @weihanglo

rustbot has assigned @weihanglo.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added A-cli Area: Command-line interface, option parsing, etc. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 24, 2025
@ibilalkayy
Copy link
Contributor Author

r? @epage

@rustbot rustbot assigned epage and unassigned weihanglo Jan 24, 2025
Copy link
Member

@weihanglo weihanglo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I guess this may come from office hours, could you please link to the original issue, and write a clear description of what this is going to resolve? We have a PR template, if you are unsure how to write a proper description.

@ibilalkayy
Copy link
Contributor Author

ibilalkayy commented Jan 25, 2025

Thank you, @weihanglo for sharing the PR template!

I am trying to implement the feature for adding third-party subcommands. Here is the tracking issue where two of my PRs were merged relevant to the third-party subcommands and aliases but now I need to call them and during the call in the cli.rs file, this is where I faced the issues that I mentioned in the description.

I will be discussing this later on with Ed Page during an office hour.

@ibilalkayy ibilalkayy requested a review from weihanglo January 25, 2025 21:49
@epage
Copy link
Contributor

epage commented Jan 25, 2025

The closure returns a Vec of all subcommand candidates. This tries to pass all third-party subcommands as a single candidate.

Also, when sharing incomplete code like this either open it as a Draft or just push your branch and share that.

@epage epage marked this pull request as draft January 29, 2025 15:08
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-cli Area: Command-line interface, option parsing, etc. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants