2020-05-25 06:02:21 +02:00
|
|
|
mod editor;
|
2020-05-20 11:14:51 +02:00
|
|
|
|
2020-05-25 06:02:21 +02:00
|
|
|
use editor::Editor;
|
2020-05-20 11:14:51 +02:00
|
|
|
|
2020-05-25 06:02:21 +02:00
|
|
|
use argh::FromArgs;
|
|
|
|
use std::{env, path::PathBuf};
|
2020-05-20 11:14:51 +02:00
|
|
|
|
2020-05-25 06:02:21 +02:00
|
|
|
use anyhow::Error;
|
2020-05-20 11:14:51 +02:00
|
|
|
|
2020-05-25 06:02:21 +02:00
|
|
|
#[derive(FromArgs)]
|
|
|
|
/// A post-modern text editor.
|
|
|
|
pub struct Args {
|
|
|
|
#[argh(positional)]
|
|
|
|
files: Vec<PathBuf>,
|
2020-05-20 11:14:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() -> Result<(), Error> {
|
2020-05-25 06:02:21 +02:00
|
|
|
let args: Args = argh::from_env();
|
|
|
|
let mut editor = Editor::new(args)?;
|
2020-05-20 11:14:51 +02:00
|
|
|
|
2020-05-25 06:02:21 +02:00
|
|
|
editor.run()?;
|
2020-05-20 11:14:51 +02:00
|
|
|
|
|
|
|
Ok(())
|
|
|
|
}
|