-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
230 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Changelog | ||
|
||
## v1.1.0 | ||
|
||
- A new command [`check`](https://github.com/zekroTJA/goup/blob/main/docs/commands.md#check) has been added which can be used to check for new upstream versions compared to the currently used one. | ||
 | ||
|
||
- Remote versions are now fetched via the GitHub REST API and `git ls-remote --tags` is only used as fallback. This should improve the performance significantly. [#1] | ||
|
||
- A warning is now printed using the commands `ls`, `current` and `use` when the required environment variables are not set. | ||
|
||
- A better about description has been added to the `env` command when displaying the long help using `help env` or `env --help`. | ||
|
||
|
||
## v1.0.0 | ||
|
||
- Initial release. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Set FontSize 30 | ||
Set Padding 30 | ||
Set WindowBar Colorful | ||
|
||
Type "goup ls" | ||
Enter | ||
Sleep 1s | ||
Type "goup use 1.19.0" | ||
Enter | ||
Sleep 1s | ||
Type "goup check" | ||
Enter | ||
Sleep 1s | ||
Type "goup use 1.20.0" | ||
Enter | ||
Sleep 6s | ||
Type "goup check" | ||
Enter | ||
Sleep 1s | ||
Type "goup use" | ||
Enter | ||
Sleep 1s | ||
Type "goup check" | ||
Enter | ||
Sleep 5s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
use super::Command; | ||
use crate::{ | ||
env::*, | ||
success, | ||
versions::{get_upstream_versions, Version, VersionPart}, | ||
warning, | ||
}; | ||
use clap::Args; | ||
use console::style; | ||
|
||
/// Check for updates. | ||
#[derive(Args)] | ||
pub struct Check {} | ||
|
||
impl Command for Check { | ||
fn run(&self) -> anyhow::Result<()> { | ||
check_env_applied()?; | ||
|
||
let Some(current) = get_current_version()? else { | ||
warning!("No version has been selected.\n\ | ||
Use `goup use` to select an SDK version."); | ||
return Ok(()); | ||
}; | ||
|
||
let upstream_versions = get_upstream_versions()?; | ||
|
||
let new_minor = upstream_versions | ||
.iter() | ||
.rev() | ||
.find(|v| v.minor > current.minor && current.strip_after(VersionPart::Major).covers(v)); | ||
|
||
let new_patch = upstream_versions | ||
.iter() | ||
.rev() | ||
.find(|v| v.patch > current.patch && current.strip_after(VersionPart::Minor).covers(v)); | ||
|
||
let mut new_pre = None; | ||
if !current.is_stable() { | ||
new_pre = upstream_versions | ||
.iter() | ||
.rev() | ||
.find(|v| v.pre > current.pre && current.strip_after(VersionPart::Patch).covers(v)); | ||
} | ||
|
||
checkprint("pre-release", ¤t, new_pre); | ||
checkprint("minor", ¤t, new_minor); | ||
checkprint("patch", ¤t, new_patch); | ||
|
||
if new_pre.is_none() && new_minor.is_none() && new_patch.is_none() { | ||
success!("You are up to date with the latest upstream version!"); | ||
} | ||
|
||
Ok(()) | ||
} | ||
} | ||
|
||
fn checkprint(typ: &str, current: &Version, v: Option<&Version>) { | ||
if let Some(new) = v { | ||
success!("New {typ} version is available!"); | ||
println!( | ||
"{} → {}", | ||
style(current.to_string()).dim(), | ||
style(new).cyan() | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.