Skip to content

Commit d5e4685

Browse files
committed
list extension update paths
1 parent 2fb9f68 commit d5e4685

2 files changed

Lines changed: 20 additions & 7 deletions

File tree

cli/src/commands/install.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,12 @@ async fn extension_versions(
115115
}
116116

117117
#[derive(sqlx::FromRow, PartialEq, Eq, Hash)]
118-
struct UpdatePath {
119-
source: String,
120-
target: String,
118+
pub(crate) struct UpdatePath {
119+
pub(crate) source: String,
120+
pub(crate) target: String,
121121
}
122122

123-
async fn update_paths(
123+
pub(crate) async fn update_paths(
124124
conn: &mut PgConnection,
125125
extension_name: &str,
126126
) -> anyhow::Result<HashSet<UpdatePath>> {

cli/src/commands/list.rs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,27 @@ use std::collections::HashMap;
33
use futures::TryStreamExt;
44
use sqlx::PgConnection;
55

6+
use crate::commands::install::update_paths;
7+
68
pub(crate) async fn list(conn: &mut PgConnection) -> anyhow::Result<()> {
79
let available_extensions = available_extensions(conn).await?;
810

9-
for (extension, versions) in available_extensions {
10-
println!("{extension}");
11+
for (extension_name, versions) in available_extensions {
12+
println!("{extension_name}");
13+
println!(" available versions:");
1114
for version in versions {
12-
println!(" {version}");
15+
println!(" {version}");
16+
}
17+
println!(" available update paths:");
18+
let update_paths = update_paths(conn, &extension_name).await?;
19+
if update_paths.is_empty() {
20+
println!(" None");
21+
} else {
22+
for update_path in update_paths {
23+
println!(" from {} to {}", update_path.source, update_path.target);
24+
}
1325
}
26+
println!();
1427
}
1528

1629
Ok(())

0 commit comments

Comments
 (0)