2023-01-21 02:05:51 +00:00
|
|
|
#![deny(clippy::all, clippy::cargo, clippy::pedantic)]
|
2023-01-21 02:09:08 +00:00
|
|
|
#![allow(clippy::needless_pass_by_value, clippy::match_bool)]
|
2023-01-19 02:11:47 +00:00
|
|
|
|
2023-01-19 01:47:14 +00:00
|
|
|
use clap::Parser;
|
|
|
|
use mlua::Result;
|
|
|
|
|
|
|
|
mod cli;
|
|
|
|
mod lune;
|
|
|
|
mod utils;
|
|
|
|
|
|
|
|
use cli::Cli;
|
2023-01-20 20:21:20 +00:00
|
|
|
use utils::{pretty_print_luau_error, print_label};
|
2023-01-19 01:47:14 +00:00
|
|
|
|
|
|
|
#[tokio::main]
|
|
|
|
async fn main() -> Result<()> {
|
|
|
|
let cli = Cli::parse();
|
|
|
|
match cli.run().await {
|
|
|
|
Ok(_) => Ok(()),
|
|
|
|
Err(e) => {
|
|
|
|
eprintln!();
|
2023-01-20 20:21:20 +00:00
|
|
|
print_label("ERROR").unwrap();
|
|
|
|
eprintln!();
|
2023-01-19 01:47:14 +00:00
|
|
|
pretty_print_luau_error(&e);
|
|
|
|
std::process::exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[tokio::test]
|
|
|
|
async fn hello_lune() {
|
2023-01-19 05:23:06 +00:00
|
|
|
let args = vec!["Hello, test! ✅".to_owned()];
|
|
|
|
let cli = Cli::from_path_with_args("hello_lune", args);
|
2023-01-19 01:47:14 +00:00
|
|
|
let result = cli.run().await;
|
|
|
|
assert!(result.is_ok());
|
|
|
|
}
|