-
Notifications
You must be signed in to change notification settings - Fork 604
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add command
goose update
to update goose CLI version (#1308)
Co-authored-by: Alex Hancock <[email protected]>
- Loading branch information
1 parent
fd3ebee
commit 26348a6
Showing
4 changed files
with
67 additions
and
3 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 |
---|---|---|
|
@@ -2,3 +2,4 @@ pub mod agent_version; | |
pub mod configure; | ||
pub mod info; | ||
pub mod mcp; | ||
pub mod update; |
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,34 @@ | ||
use std::process::Command; | ||
|
||
use anyhow::Result; | ||
|
||
const DOWNLOAD_SCRIPT_URL: &str = | ||
"https://github.com/block/goose/releases/download/stable/download_cli.sh"; | ||
|
||
pub fn update(canary: bool, reconfigure: bool) -> Result<()> { | ||
// Get the download script from github | ||
let curl_output = Command::new("curl") | ||
.arg("-fsSL") | ||
.arg(DOWNLOAD_SCRIPT_URL) | ||
.output()?; | ||
|
||
if !curl_output.status.success() { | ||
anyhow::bail!( | ||
"Failed to download update script: {}", | ||
std::str::from_utf8(&curl_output.stderr)? | ||
); | ||
} | ||
|
||
let shell_str = std::str::from_utf8(&curl_output.stdout)?; | ||
|
||
let update = Command::new("bash") | ||
.arg("-c") | ||
.arg(shell_str) | ||
.env("CANARY", canary.to_string()) | ||
.env("CONFIGURE", reconfigure.to_string()) | ||
.spawn()?; | ||
|
||
update.wait_with_output()?; | ||
|
||
Ok(()) | ||
} |
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