mod editor;
mod trigger;
mod utils;
use clap::{arg, command, ArgMatches};
use editor::Editor;
fn get_matches() -> ArgMatches {
command!()
.arg(arg!(<INPUT_FILE>).help("File containing decision table to edit").required(true).index(1))
.get_matches()
}
fn start(content: String) -> std::io::Result<()> {
Editor::new(content)?.start()
}
fn main() -> std::io::Result<()> {
let matches = get_matches();
let file_name = matches.get_one::<String>("INPUT_FILE").unwrap().to_string();
if let Ok(content) = std::fs::read_to_string(file_name) {
crossterm::terminal::enable_raw_mode()?;
let _ = start(content);
crossterm::terminal::disable_raw_mode()?;
}
Ok(())
}