Skip to content

Commit 492a01a

Browse files
committed
Fix missing "exe" variant and copy-paste mistakes in Format
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.
1 parent 58eb125 commit 492a01a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

xbuild/src/lib.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -167,17 +167,18 @@ impl std::fmt::Display for Format {
167167
impl std::str::FromStr for Format {
168168
type Err = anyhow::Error;
169169

170-
fn from_str(arch: &str) -> Result<Self> {
171-
Ok(match arch {
170+
fn from_str(format: &str) -> Result<Self> {
171+
Ok(match format {
172172
"aab" => Self::Aab,
173173
"apk" => Self::Apk,
174174
"appbundle" => Self::Appbundle,
175175
"appdir" => Self::Appdir,
176176
"appimage" => Self::Appimage,
177177
"dmg" => Self::Dmg,
178+
"exe" => Self::Exe,
178179
"ipa" => Self::Ipa,
179180
"msix" => Self::Msix,
180-
_ => anyhow::bail!("unsupported arch {}", arch),
181+
_ => anyhow::bail!("unsupported format {}", format),
181182
})
182183
}
183184
}

0 commit comments

Comments
 (0)