use crate::ops::forc_check;
use anyhow::Result;
use clap::Parser;
use sway_core::{declaration_engine::DeclarationEngine, Engines, TypeEngine};
#[derive(Debug, Default, Parser)]
pub struct Command {
#[clap(short, long)]
pub path: Option<String>,
#[clap(long = "offline")]
pub offline_mode: bool,
#[clap(long)]
pub locked: bool,
#[clap(long = "terse", short = 't')]
pub terse_mode: bool,
}
pub(crate) fn exec(command: Command) -> Result<()> {
let type_engine = TypeEngine::default();
let declaration_engine = DeclarationEngine::default();
let engines = Engines::new(&type_engine, &declaration_engine);
let res = forc_check::check(command, engines)?;
if !res.is_ok() {
anyhow::bail!("unable to type check");
}
Ok(())
}