Skip to content

Commit c6b938b

Browse files
author
Arnaud Riess
committed
fix: remove unused CLI options and set default values for transpilation
1 parent f309dfa commit c6b938b

2 files changed

Lines changed: 6 additions & 19 deletions

File tree

crates/herkos/src/main.rs

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,37 +11,24 @@ struct Cli {
1111
/// Input WebAssembly binary (.wasm)
1212
input: PathBuf,
1313

14-
/// Code generation backend
15-
#[arg(long, default_value = "safe", value_parser = ["safe", "verified", "hybrid"])]
16-
mode: String,
17-
1814
/// Output Rust source file
1915
#[arg(long, short)]
2016
output: Option<PathBuf>,
21-
22-
/// Override maximum memory pages when the Wasm module declares no maximum
23-
#[arg(long, default_value = "256")]
24-
max_pages: usize,
2517
}
2618

2719
fn main() -> Result<()> {
2820
let cli = Cli::parse();
2921

30-
eprintln!(
31-
"herkos: transpiling {} (mode={}, max_pages={})",
32-
cli.input.display(),
33-
cli.mode,
34-
cli.max_pages,
35-
);
22+
eprintln!("herkos: transpiling {}", cli.input.display(),);
3623

3724
// Read WASM file
3825
let wasm_bytes =
3926
fs::read(&cli.input).with_context(|| format!("failed to read {}", cli.input.display()))?;
4027

4128
// Configure transpilation options
4229
let options = TranspileOptions {
43-
mode: cli.mode.clone(),
44-
max_pages: cli.max_pages,
30+
mode: "safe".to_string(),
31+
max_pages: 256,
4532
};
4633

4734
// Transpile using library function
@@ -68,7 +55,7 @@ mod tests {
6855
#[test]
6956
fn cli_parses_defaults() {
7057
let cli = Cli::parse_from(["herkos", "input.wasm"]);
71-
assert_eq!(cli.mode, "safe");
72-
assert_eq!(cli.max_pages, 256);
58+
assert_eq!(cli.input, PathBuf::from("input.wasm"));
59+
assert!(cli.output.is_none());
7360
}
7461
}

examples/c-to-wasm-to-rust/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)