Skip to content

Commit a9ba2ad

Browse files
stwo_vm_runner: add help strings + display help in arg parser (#191)
1 parent 84378ab commit a9ba2ad

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

crates/vm_runner/src/main.rs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,22 @@ use stwo_cairo_utils::binary_utils::run_binary;
1515
use thiserror::Error;
1616
use tracing::{span, Level};
1717

18-
/// Command line arguments for stwo_vm_runner.
19-
/// Example command line (use absolute paths):
20-
/// ```
21-
/// cargo run -r --bin stwo_vm_runner -- --program path/to/program --program_input
22-
/// path/to/input --layout <LayoutName> --output_execution_resources_path path/to/output
23-
/// ```
2418
#[derive(Parser, Debug)]
2519
#[clap(author, version, about, long_about = None)]
2620
struct Args {
27-
#[clap(long = "program", help = "Path to the compiled program")]
21+
#[clap(long = "program", help = "Absolute path to the compiled program.")]
2822
program: PathBuf,
29-
#[clap(long = "program_input", help = "Path to the program input file.")]
23+
#[clap(
24+
long = "program_input",
25+
help = "Absolute path to the program input file."
26+
)]
3027
program_input: Option<PathBuf>,
31-
#[clap(long = "layout")]
28+
#[clap(long = "layout", help = "Layout name.")]
3229
layout: LayoutName,
33-
#[structopt(long = "output_execution_resources_path")]
30+
#[structopt(
31+
long = "output_execution_resources_path",
32+
help = "Abosolute path to the program's execution resources (output file)."
33+
)]
3434
output_execution_resources_path: PathBuf,
3535
}
3636

@@ -57,7 +57,10 @@ fn main() -> ExitCode {
5757
#[allow(clippy::result_large_err)]
5858
fn run(args: impl Iterator<Item = String>) -> Result<ProverInput, Error> {
5959
let _span = span!(Level::INFO, "run").entered();
60-
let args = Args::try_parse_from(args)?;
60+
let args = match Args::try_parse_from(args) {
61+
Ok(args) => args,
62+
Err(err) => err.exit(),
63+
};
6164

6265
let program = get_program(args.program.as_path())?;
6366
let program_input_contents = get_program_input(&args.program_input)?;

0 commit comments

Comments
 (0)