Skip to content

Commit

Permalink
Fix missing "exe" variant and copy-paste mistakes in Format
Browse files Browse the repository at this point in the history
Passing `--format exe` would fail, complaining that the "arch" `exe`
is not supported.  Copy-paste mistakes from "arch" to "format" aside,
the `"exe"` string wasn't in the match arm.

Realistically, as we are already utilizing `clap`, we should remove
all this error-prone (proven by this example) open-coding of broken
parsers and utilize their derives to automatically generate conversion
functions.

This should at the same time assist us in generating help files, as the
hardcoded documentation for `--format` currently states that `exe` is a
supported value.
  • Loading branch information
MarijnS95 committed Dec 22, 2024
1 parent ffe3e34 commit 82a95f5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions xbuild/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,17 +167,18 @@ impl std::fmt::Display for Format {
impl std::str::FromStr for Format {
type Err = anyhow::Error;

fn from_str(arch: &str) -> Result<Self> {
Ok(match arch {
fn from_str(format: &str) -> Result<Self> {
Ok(match format {
"aab" => Self::Aab,
"apk" => Self::Apk,
"appbundle" => Self::Appbundle,
"appdir" => Self::Appdir,
"appimage" => Self::Appimage,
"dmg" => Self::Dmg,
"exe" => Self::Exe,
"ipa" => Self::Ipa,
"msix" => Self::Msix,
_ => anyhow::bail!("unsupported arch {}", arch),
_ => anyhow::bail!("unsupported format {}", format),
})
}
}
Expand Down

0 comments on commit 82a95f5

Please sign in to comment.