add experimental self-update functionality#62
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
| #[clap(about = "Show version and config file locations")] | ||
| Version, | ||
| #[clap(about = "Self-update coman. Experimental", hide = true)] | ||
| Update, |
There was a problem hiding this comment.
The Update command is marked as experimental and hidden, which might cause confusion for users expecting it to be available.
#ai-review-inline
| tokio-duplex = "1.0.1" | ||
| sysinfo = "0.38.0" | ||
| bytesize = "2.3.1" | ||
| self_update = { version = "0.42.0", features = ["archive-tar", "archive-zip"] } |
There was a problem hiding this comment.
Added self_update crate with archive features, ensure these features are necessary for the intended use case.
| self_update = { version = "0.42.0", features = ["archive-tar", "archive-zip"] } | |
| self_update = { version = "0.42.0", features = ["archive-tar", "archive-zip"] } |
#ai-review-inline
| match args.command { | ||
| Some(command) => match command { | ||
| CliCommands::Version => println!("{}", version()), | ||
| CliCommands::Update => { |
There was a problem hiding this comment.
Consider adding error handling for the update task instead of using unwrap().
| CliCommands::Update => { | |
| tokio::task::spawn_blocking(move || { | |
| if let Err(e) = update() { | |
| eprintln!("Update failed: {}", e); | |
| } | |
| }).await? |
#ai-review-inline
| ]))) | ||
| } | ||
|
|
||
| fn update() -> Result<()> { |
There was a problem hiding this comment.
The update function should handle errors more gracefully instead of panicking with unwrap().
| fn update() -> Result<()> { | |
| fn update() -> Result<()> { | |
| let status = self_update::backends::github::Update::configure() | |
| .repo_owner("SwissDataScienceCenter") | |
| .repo_name("coman") | |
| .bin_name("coman") | |
| .show_download_progress(true) | |
| .current_version(cargo_crate_version!()) | |
| .build()?; | |
| let status = status.update()?; | |
| println!("Update status: `{}`", status.version()); | |
| Ok(()) | |
| } |
#ai-review-inline
| target: aarch64-pc-windows-msvc | ||
| bin: coman.exe | ||
| name: coman-Windows-aarch64.zip | ||
| name: coman-aarch64-pc-windows-msvc.zip |
There was a problem hiding this comment.
The naming convention for the Windows aarch64 artifact has been updated for consistency.
| name: coman-aarch64-pc-windows-msvc.zip | |
| name: coman-aarch64-pc-windows-msvc.zip |
#ai-review-inline
| target: x86_64-apple-darwin | ||
| bin: coman | ||
| name: coman-Darwin-x86_64.tar.gz | ||
| name: coman-x86_64-apple-darwin.tar.gz |
There was a problem hiding this comment.
The naming convention for the macOS x86_64 artifact has been updated for consistency.
| name: coman-x86_64-apple-darwin.tar.gz | |
| name: coman-x86_64-apple-darwin.tar.gz |
#ai-review-inline
| target: x86_64-unknown-linux-musl | ||
| bin: coman | ||
| name: coman-Linux-x86_64-musl.tar.gz | ||
| name: coman-x86_64-unknown-linux-musl.tar.gz |
There was a problem hiding this comment.
The naming convention for the Linux x86_64 artifact has been updated for consistency.
| name: coman-x86_64-unknown-linux-musl.tar.gz | |
| name: coman-x86_64-unknown-linux-musl.tar.gz |
#ai-review-inline
| target: aarch64-unknown-linux-musl | ||
| bin: coman | ||
| name: coman-Linux-aarch64-musl.tar.gz | ||
| name: coman-aarch64-unknown-linux-musl.tar.gz |
There was a problem hiding this comment.
The naming convention for the Linux aarch64 artifact has been updated for consistency.
| name: coman-aarch64-unknown-linux-musl.tar.gz | |
| name: coman-aarch64-unknown-linux-musl.tar.gz |
#ai-review-inline
907ebe5 to
38b841b
Compare
User description
I had to change the release artifact names to match what the self-updating library expects.
Command is currently hidden for testing
PR Type
Enhancement
Description
Adds experimental self-update functionality
Updates release artifact naming for compatibility
Integrates self-update crate with GitHub backend
Hides update command for testing purposes
Diagram Walkthrough
File Walkthrough
app.rs
CLI Update Command Additioncoman/src/cli/app.rs
Updatecommand to CLI enummain.rs
Self-update Implementationcoman/src/main.rs
self_updatecrateupdate()function using GitHub backendrelease.yaml
Release Artifact Naming Update.github/workflows/release.yaml
Cargo.toml
Add Self-Update Dependencycoman/Cargo.toml
self_updatedependency with archive support