summaryrefslogtreecommitdiff
path: root/crates/typst-cli/src/update.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/typst-cli/src/update.rs')
-rw-r--r--crates/typst-cli/src/update.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/typst-cli/src/update.rs b/crates/typst-cli/src/update.rs
index b22eb7c5..562d7d2d 100644
--- a/crates/typst-cli/src/update.rs
+++ b/crates/typst-cli/src/update.rs
@@ -21,7 +21,7 @@ const TYPST_REPO: &str = "typst";
/// Fetches a target release or the latest release (if no version was specified)
/// from GitHub, unpacks it and self replaces the current binary with the
/// pre-compiled asset from the downloaded release.
-pub fn update(command: UpdateCommand) -> StrResult<()> {
+pub fn update(command: &UpdateCommand) -> StrResult<()> {
if let Some(ref version) = command.version {
let current_tag = env!("CARGO_PKG_VERSION").parse().unwrap();
@@ -61,7 +61,7 @@ pub fn update(command: UpdateCommand) -> StrResult<()> {
fs::copy(current_exe, &backup_path)
.map_err(|err| eco_format!("failed to create backup: {err}"))?;
- let release = Release::from_tag(command.version)?;
+ let release = Release::from_tag(command.version.as_ref())?;
if !update_needed(&release)? && !command.force {
eprintln!("Already up-to-date.");
return Ok(());
@@ -99,7 +99,7 @@ struct Release {
impl Release {
/// Download the target release, or latest if version is `None`, from the
/// Typst repository.
- pub fn from_tag(tag: Option<Version>) -> StrResult<Release> {
+ pub fn from_tag(tag: Option<&Version>) -> StrResult<Release> {
let url = match tag {
Some(tag) => format!(
"https://api.github.com/repos/{}/{}/releases/tags/v{}",