1
119
#![warn(clippy::all, clippy::pedantic)]
2

            
3
mod commands;
4
mod config;
5
mod console;
6
mod document;
7
mod editor;
8
mod help;
9
mod history;
10
mod indexing;
11
mod mode;
12
mod navigator;
13
mod row;
14
mod terminal;
15
mod utils;
16

            
17
use editor::Editor;
18
use structopt::StructOpt;
19

            
20
pub use config::Config;
21
pub use console::{Console, ConsoleSize};
22
pub use document::Document;
23
pub use editor::{Position, ViewportOffset};
24
pub use help::{Help, Section};
25
pub use history::{History, Operation, OperationType};
26
pub use indexing::{LineNumber, RowIndex};
27
pub use mode::Mode;
28
pub use navigator::{Boundary, Navigator};
29
pub use row::Row;
30
pub use terminal::{AnsiPosition, Terminal};
31
pub use utils::{bo_version, log};
32

            
33
#[derive(Debug, StructOpt)]
34
#[structopt(name = "bo", about = "An opinionated text editor")]
35
struct Opt {
36
    /// Version flag
37
    #[structopt(long)]
38
    version: bool,
39

            
40
    /// File name
41
    #[structopt(name = "FILE")]
42
    file_name: Option<String>,
43
}
44

            
45
fn main() {
46
    let opt = Opt::from_args();
47
    if opt.version {
48
        println!("{}", bo_version());
49
    } else {
50
        let term = Box::new(Terminal::default().unwrap());
51
        Editor::new(opt.file_name, term).run();
52
    }
53
}