rust-lang / cargo

The Rust package manager
https://doc.rust-lang.org/cargo
Apache License 2.0
12.74k stars 2.42k forks source link

"cargo search" can be deceiving in that it implicitly truncates the result at the first 10 crates #2402

Closed nodakai closed 8 years ago

nodakai commented 8 years ago

cargo search is hard-coded to truncate the result at the first 10 crates, without providing any ways to access to the rest of the matches.

And even worse, it doesn't say the search result was truncated. For example, the following output is really deceiving:

$ cargo search time
    Updating registry `https://github.com/rust-lang/crates.io-index`
chrono (0.2.19)                 Date and time library for Rust
cargo-script (0.1.4)            A Cargo subcommand designed to let people quickly and easily run Rust "scripts" which can make use of Cargo's package ecosystem…
time_calc (0.10.1)              A library for music/DSP time conversions! Provides functions and methods for converting between ticks, ms, samples, bars, beats…
carboxyl_time (0.0.2)           FRP timing utilities
timely_communication (0.1.3)    Communication layer for timely dataflow
timely_sort (0.1.2)             Sorting infrastructure for timely dataflow
lru_time_cache (0.2.6)          Implementation of a Least Recently Used caching algorithm in a container which may be limited by size or time, ordered by most …
timely (0.0.12)                 A low-latency data-parallel dataflow system in Rust
time-sys (0.0.2)                Bindings to Linux's time.h and time64.h. Some functions have been replicated, but more are still to come.
constant_time_eq (0.1.2)        Compares two equal-sized byte strings in constant time.

It's as if the time crate (https://crates.io/crates/time) doesn't exist at all.

Compare it with:

Displaying 1-10 of 278 total results

chrono 0.2.19 Date and time library for Rust

cargo-script 0.1.4 A Cargo subcommand designed to let people quickly and easily run Rust "scripts" which can make use of Cargo's package ecosystem.

time_calc 0.10.1 A library for music/DSP time conversions! Provides functions and methods for converting between ticks, ms, samples, bars, beats and measures.

carboxyl_time 0.0.2 FRP timing utilities

timely_communication 0.1.3 Communication layer for timely dataflow

timely_sort 0.1.2 Sorting infrastructure for timely dataflow

lru_time_cache 0.2.6 Implementation of a Least Recently Used caching algorithm in a container which may be limited by size or time, ordered by most recently seen.

timely 0.0.12 A low-latency data-parallel dataflow system in Rust

time-sys 0.0.2 Bindings to Linux's time.h and time64.h. Some functions have been replicated, but more are still to come.

constant_time_eq 0.1.2 Compares two equal-sized byte strings in constant time.

(emphasis mine)

jespino commented 8 years ago

I think I solved this bug, but I'm starting to contribute to the project I'm not sure I'm breaking anything (I changed a little the API).

nodakai commented 8 years ago

I think the problem is the user might not notice they need to add --limit N at all.

jespino commented 8 years ago

Can be interesting to include a text at the end like "and X more (use --limit parameter to see more crates)"

What do you think about it @alexcrichton ?

alexcrichton commented 8 years ago

We may even want to just decode the pagination information and that way we could auto-show the message and even indicate how many more are there.

jespino commented 8 years ago

I have added it (Could be a better option for the texts, suggestions are welcome :smile: )

jespino commented 8 years ago

I think this issue is fixed with the last merged PR

alexcrichton commented 8 years ago

Thanks @jespino!