diff --git a/Cargo.lock b/Cargo.lock index c9e263ab..746a5a24 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2145,6 +2145,7 @@ dependencies = [ "octocrab", "rocks-lib", "rustyline", + "serde_json", "spdx", "spinners", "termcolor", diff --git a/rocks-bin/Cargo.toml b/rocks-bin/Cargo.toml index ac56d63c..feba0394 100644 --- a/rocks-bin/Cargo.toml +++ b/rocks-bin/Cargo.toml @@ -12,6 +12,7 @@ itertools = "0.12.1" nucleo = "0.4.1" octocrab = "0.36.0" rustyline = "14.0.0" +serde_json = "1.0.118" spdx = "0.10.4" spinners = "4.1.1" termcolor = "1.4.1" diff --git a/rocks-bin/src/list.rs b/rocks-bin/src/list.rs index 8f09c2d6..72b4c801 100644 --- a/rocks-bin/src/list.rs +++ b/rocks-bin/src/list.rs @@ -25,9 +25,7 @@ pub fn list(list_data: List, config: &Config) -> Result<()> { // TODO(vhyrro): Add `outdated` support. if list_data.porcelain { - for (name, versions) in available_rocks { - println!("{}: {}", name, versions.join(" ")); - } + println!("{}", serde_json::to_string(&available_rocks)?); } else { let formatting = TreeFormatting::dir_tree(FormatCharacters::box_chars()); for (name, versions) in available_rocks.into_iter().sorted() {