1pub mod args;
2pub mod exec;
3pub mod print_title;
4
5use super::{github_actions, log::syntax_highlight::SyntaxHighLight, Error, PrettyExec};
6use clap::Parser;
7use pipe_trait::Pipe;
8use std::{
9 ffi::{OsStr, OsString},
10 process::ExitStatus,
11};
12
13pub struct Param<'a> {
14 pub program: &'a OsStr,
15 pub arguments: &'a [OsString],
16 pub prompt: &'a str,
17 pub skip_exec: bool,
18 pub syntax_highlight: SyntaxHighLight,
19 pub support_github_action: bool,
20}
21
22pub fn main() -> Result<i32, Error> {
23 let args = args::Args::parse();
24 let param = args.param()?;
25
26 if param.skip_exec {
27 print_title::print_title(param);
28 return Ok(0);
29 }
30
31 exec::exec(param)?
32 .pipe_ref(ExitStatus::code)
33 .ok_or(Error::StatusCodeAcquisitionFailure)
34}