rust-lang / rust-lang/cargo

Cargo search using maximum result limit hardcodes the crates.io URL

Open
#7,909 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug S-needs-design
Dominant language
Rust
Stars
15.5k
Forks
3k
Avg merge
23h 30m
Merged PRs (30d)
51

Description

Problem

When using cargo search against a private registry with --limit 100, I expect the message directing me to additional search results to contain the URL for my private registry.

Instead, the URL appears to be hard-coded here to direct users to crates.io.

Steps

  1. Upload a package to a registry other than crates.io
  2. Use cargo search --registry your-registry --limit 100 test_package
  3. Receive the message directing you to https://crates.io/search?q=test%5Fpackage

Possible Solution(s)

Use the registry index for this message instead of hard-coding the string

Notes

Output of cargo version:

cargo 1.40.0 (bc8e4c8be 2019-11-22)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/cargo/ops/registry.rs around line 770 and reproduce the issue with cargo search --registry your-registry --limit 100 test_package. Trace how the registry is selected and how the additional-results message is built. Done means the message uses the selected private registry URL instead of always directing users to crates.io.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.