Skip to content

feat(spin): add new module for Spin #6238

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 11 commits into
base: master
Choose a base branch
from

Conversation

ThorstenHans
Copy link
Contributor

Description

This PR adds a new module for Spin, allowing Spin users to display the currently installed version of the Spin CLI in their prompt.

Motivation and Context

As a developer using Spin to build WebAssembly applications, I want to display the current version of Spin as part of my prompt. This is especially useful for Spin users that leverage Spin's version manager to switch between multiple versions of Spin on their machine.

Screenshots (if appropriate):

image

How Has This Been Tested?

I installed Spin CLI on my machine using homebrew (brew install fermyon/tap/spin), and updated my starship.toml by adding:

[spin]
disabled = false
permanent = true

To display the currently installed version of Spin also outside of Spin App directories, I set the permanent option to true.

  • I have tested using MacOS
  • I have tested using Linux
  • I have tested using Windows

Checklist:

  • I have updated the documentation accordingly.
  • I have updated the tests accordingly.

Comment on lines 74 to 79
let capture = semver_regex.find(input)?.as_str();
if input.contains(SPIN_CANARY_IDENTIFIER) {
Some(format!("{} ({})", capture, SPIN_CANARY))
} else {
Some(capture.to_string())
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you replace pre in the version name with canary?

Copy link
Contributor Author

@ThorstenHans ThorstenHans Sep 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initially I thought it would be more self-explaining. However, you're right, 2.8.0 (pre) makes more sense than 2.8.0 (canary)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if rewriting the version here at all is a good idea.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I changed the implementation to use versions provided by spin --version as they are

@ThorstenHans
Copy link
Contributor Author

@davidkna any chance to get a new review?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants