#[macro_use]
extern crate log;
extern crate miette;
extern crate xx;
use std::path::PathBuf;
use miette::Result;
use cli::Cli;
mod cli;
pub mod env;
mod errors;
mod hash;
mod shebang;
#[cfg(test)]
mod test;
pub fn run(args: &[String]) -> Result<()> {
if let Some(script) = args.get(1) {
if script.to_lowercase() == "-v" {
println!("{} {}", env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION"));
return Ok(());
}
if script.starts_with("./") || script.starts_with('/') {
let script: PathBuf = script.into();
if script.starts_with("./") && script.exists() {
return shebang::execute(&script, args);
}
}
}
Cli::run(args)
}