blob: 7b1583ec25e1012b482af4c4993aff2783f92486 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
#![feature(vec_remove_item)]
#![feature(trivial_bounds)]
#![feature(try_trait)]
extern crate termion;
extern crate unicode_width;
#[macro_use]
extern crate lazy_static;
extern crate failure;
extern crate failure_derive;
extern crate alphanumeric_sort;
extern crate dirs_2;
extern crate lscolors;
extern crate users;
extern crate chrono;
extern crate mime_detective;
extern crate rayon;
extern crate libc;
extern crate notify;
extern crate parse_ansi;
use failure::Fail;
use termion::input::MouseTerminal;
use termion::raw::IntoRawMode;
use termion::screen::AlternateScreen;
use std::io::{stdout, Write};
mod coordinates;
mod file_browser;
mod files;
mod listview;
mod miller_columns;
mod preview;
mod term;
mod textview;
mod widget;
mod win_main;
mod hbox;
mod tabview;
mod async_widget;
mod fail;
mod minibuffer;
mod proclist;
mod bookmarks;
mod paths;
mod foldview;
use widget::{Widget, WidgetCore};
use term::ScreenExt;
use fail::HResult;
use file_browser::FileBrowser;
use tabview::TabView;
fn main() -> HResult<()> {
// do this early so it might be ready when needed
crate::files::load_tags().ok();
let core = WidgetCore::new().expect("Can't create WidgetCore!");
match run(core.clone()) {
Ok(_) => Ok(()),
Err(err) => {
eprintln!("{:?}\n{:?}", err, err.cause());
return Err(err);
}
}
}
fn run(mut core: WidgetCore) -> HResult<()> {
let filebrowser = FileBrowser::new_cored(&core)?;
let mut tabview = TabView::new(&core);
tabview.push_widget(filebrowser)?;
tabview.handle_input()?;
core.screen.cursor_show()?;
core.screen.flush()?;
Ok(())
}
|