Merge pull request #1628 from startling/cargo-descriptions

Implemented package descriptions for cargo
This commit is contained in:
Brian Anderson 2012-01-23 20:46:33 -08:00
commit 3d08840f34

View File

@ -34,6 +34,7 @@ type package = {
uuid: str, uuid: str,
url: str, url: str,
method: str, method: str,
description: str,
ref: option::t<str>, ref: option::t<str>,
tags: [str] tags: [str]
}; };
@ -271,12 +272,22 @@ fn load_one_source_package(&src: source, p: map::hashmap<str, json::json>) {
} }
_ { } _ { }
} }
let description = alt p.find("description") {
some(json::string(_n)) { _n }
_ {
warn("Malformed source json: " + src.name + " (missing description)");
ret;
}
};
vec::grow(src.packages, 1u, { vec::grow(src.packages, 1u, {
// source: _source(src), // source: _source(src),
name: name, name: name,
uuid: uuid, uuid: uuid,
url: url, url: url,
method: method, method: method,
description: description,
ref: ref, ref: ref,
tags: tags tags: tags
}); });
@ -683,6 +694,9 @@ fn print_pkg(s: source, p: package) {
m = m + " [" + str::connect(p.tags, ", ") + "]"; m = m + " [" + str::connect(p.tags, ", ") + "]";
} }
info(m); info(m);
if p.description != "" {
print(" >> " + p.description + "\n")
}
} }
fn cmd_list(c: cargo, argv: [str]) { fn cmd_list(c: cargo, argv: [str]) {
for_each_package(c, { |s, p| for_each_package(c, { |s, p|