mirror of
https://github.com/HigherOrderCO/Bend.git
synced 2024-09-17 14:47:21 +03:00
Merge pull request #360 from PfaulJulian/main
Changed return type of fn main() in src/main.rs to fn main() -> std::process::ExitCode.
This commit is contained in:
commit
e94cb78c7d
12
src/main.rs
12
src/main.rs
@ -5,7 +5,10 @@ use bend::{
|
||||
load_file_to_book, run_book_with_fn, CompileOpts, OptLevel, RunOpts,
|
||||
};
|
||||
use clap::{Args, CommandFactory, Parser, Subcommand};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::{
|
||||
path::{Path, PathBuf},
|
||||
process::ExitCode,
|
||||
};
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(author, version, about, long_about = None)]
|
||||
@ -222,15 +225,18 @@ pub enum WarningArgs {
|
||||
RecursionCycle,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
fn main() -> ExitCode {
|
||||
#[cfg(not(feature = "cli"))]
|
||||
compile_error!("The 'cli' feature is needed for the hvm-lang cli");
|
||||
|
||||
let cli = Cli::parse();
|
||||
|
||||
if let Err(diagnostics) = execute_cli_mode(cli) {
|
||||
eprint!("{diagnostics}")
|
||||
eprint!("{diagnostics}");
|
||||
return ExitCode::FAILURE;
|
||||
}
|
||||
|
||||
ExitCode::SUCCESS
|
||||
}
|
||||
|
||||
fn execute_cli_mode(mut cli: Cli) -> Result<(), Diagnostics> {
|
||||
|
Loading…
Reference in New Issue
Block a user