about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBrian Anderson <andersrb@gmail.com>2012-01-23 20:46:33 -0800
committerBrian Anderson <andersrb@gmail.com>2012-01-23 20:46:33 -0800
commit3d08840f34a7430a84d75a28fac8a839fab0c830 (patch)
treed5351c7047d05d5044c58824b4afe30bb14966c1
parent5e13d19cc07a1e8fbf478d21cabbd7b9f80e3b54 (diff)
parent2c3cd1749e14682658ae3a958bb92404f795d263 (diff)
downloadrust-3d08840f34a7430a84d75a28fac8a839fab0c830.tar.gz
rust-3d08840f34a7430a84d75a28fac8a839fab0c830.zip
Merge pull request #1628 from startling/cargo-descriptions
Implemented package descriptions for cargo
-rw-r--r--src/cargo/cargo.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/cargo/cargo.rs b/src/cargo/cargo.rs
index ec527ab0173..6fdbeb96c14 100644
--- a/src/cargo/cargo.rs
+++ b/src/cargo/cargo.rs
@@ -34,6 +34,7 @@ type package = {
     uuid: str,
     url: str,
     method: str,
+    description: str,
     ref: option::t<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, {
         // source: _source(src),
         name: name,
         uuid: uuid,
         url: url,
         method: method,
+        description: description,
         ref: ref,
         tags: tags
     });
@@ -683,6 +694,9 @@ fn print_pkg(s: source, p: package) {
         m = m + " [" + str::connect(p.tags, ", ") + "]";
     }
     info(m);
+    if p.description != "" {
+        print("   >> " + p.description + "\n")
+    }
 }
 fn cmd_list(c: cargo, argv: [str]) {
     for_each_package(c, { |s, p|