Skip to content

Fix spacetime version list not showing current version #2680

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion crates/update/src/cli/list.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use spacetimedb_paths::SpacetimePaths;
use std::path::Path;

/// List installed SpacetimeDB versions.
#[derive(clap::Args)]
Expand All @@ -10,7 +11,16 @@ pub(super) struct List {

impl List {
pub(super) fn exec(self, paths: &SpacetimePaths) -> anyhow::Result<()> {
let current = paths.cli_bin_dir.current_version()?;
let current = match paths.cli_bin_dir.current_version()? {
None => None,
Some(path_str) => {
let file_name = Path::new(&path_str)
.file_name()
.and_then(|f| f.to_str())
.ok_or(anyhow::anyhow!("Could not extract current version"))?;
Some(file_name.to_string())
}
};
let versions = if self.all {
let client = super::reqwest_client()?;
super::tokio_block_on(super::install::available_releases(&client))??
Expand Down
Loading