1use bynk_driver::emsg;
9use std::path::PathBuf;
10use std::process::ExitCode;
11
12use crate::cli::CheckFormatArg;
13
14pub fn run(
16 input: PathBuf,
17 format: CheckFormatArg,
18 fix: Option<Vec<String>>,
19 emit: bool,
20 each: bool,
21) -> ExitCode {
22 let short = format == CheckFormatArg::Short;
23 if emit && !input.is_dir() {
24 emsg!("bynk check: error: `--emit` takes a project directory, not a single file");
25 return ExitCode::FAILURE;
26 }
27 let checked = bynk_driver::run_check("bynk", &input, short, fix.as_deref(), each);
28 if emit && checked == ExitCode::SUCCESS {
31 return if bynk_driver::tsc_report::check_emit_all("bynk", &input, short, each) {
32 ExitCode::SUCCESS
33 } else {
34 ExitCode::FAILURE
35 };
36 }
37 checked
38}