]>
git.proxmox.com Git - rustc.git/blob - src/tools/cargo/src/bin/cargo/commands/search.rs
1 use crate::command_prelude
::*;
7 pub fn cli() -> Command
{
9 .about("Search packages in crates.io")
10 .arg(Arg
::new("query").num_args(0..))
14 "Limit the number of results (default: 10, max: 100)",
18 .arg_index("Registry index URL to search packages in")
19 .arg_registry("Registry to search packages in")
21 .after_help(color_print
::cstr
!(
22 "Run `<cyan,bold>cargo help search</>` for more detailed information.\n"
26 pub fn exec(config
: &mut Config
, args
: &ArgMatches
) -> CliResult
{
27 let reg_or_index
= args
.registry_or_index(config
)?
;
28 let limit
= args
.value_of_u32("limit")?
;
29 let limit
= min(100, limit
.unwrap_or(10));
30 let query
: Vec
<&str> = args
31 .get_many
::<String
>("query")
35 let query
: String
= query
.join("+");
36 ops
::search(&query
, config
, reg_or_index
, limit
)?
;