Formats the search results printed by `cargo search` so that they can be
copied directly into a `Cargo.toml` file.
let list_items = crates.iter()
.map(|krate| (
- format!("{} ({})", krate.name, krate.max_version),
+ format!("{} = \"^{}\"", krate.name, krate.max_version),
krate.description.as_ref().map(|desc|
truncate_with_ellipsis(&desc.replace("\n", " "), 128))
))
Some(desc) => {
let space = repeat(' ').take(description_margin - name.len())
.collect::<String>();
- name + &space + &desc
+ name + &space + "# " + &desc
}
None => name
};
.with_stderr("\
[UPDATING] registry `[..]`")
.with_stdout("\
-hoare (0.1.1) Design by contract style assertions for Rust"));
+hoare = \"^0.1.1\" # Design by contract style assertions for Rust"));
}
#[test]
.with_stderr("\
[UPDATING] registry `[..]`")
.with_stdout("\
-hoare (0.1.1) Design by contract style assertions for Rust"));
+hoare = \"^0.1.1\" # Design by contract style assertions for Rust"));
}
#[test]