Skip to content

Commit 3d08840

Browse files
committed
Merge pull request #1628 from startling/cargo-descriptions
Implemented package descriptions for cargo
2 parents 5e13d19 + 2c3cd17 commit 3d08840

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/cargo/cargo.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ type package = {
3434
uuid: str,
3535
url: str,
3636
method: str,
37+
description: str,
3738
ref: option::t<str>,
3839
tags: [str]
3940
};
@@ -271,12 +272,22 @@ fn load_one_source_package(&src: source, p: map::hashmap<str, json::json>) {
271272
}
272273
_ { }
273274
}
275+
276+
let description = alt p.find("description") {
277+
some(json::string(_n)) { _n }
278+
_ {
279+
warn("Malformed source json: " + src.name + " (missing description)");
280+
ret;
281+
}
282+
};
283+
274284
vec::grow(src.packages, 1u, {
275285
// source: _source(src),
276286
name: name,
277287
uuid: uuid,
278288
url: url,
279289
method: method,
290+
description: description,
280291
ref: ref,
281292
tags: tags
282293
});
@@ -683,6 +694,9 @@ fn print_pkg(s: source, p: package) {
683694
m = m + " [" + str::connect(p.tags, ", ") + "]";
684695
}
685696
info(m);
697+
if p.description != "" {
698+
print(" >> " + p.description + "\n")
699+
}
686700
}
687701
fn cmd_list(c: cargo, argv: [str]) {
688702
for_each_package(c, { |s, p|

0 commit comments

Comments
 (0)