summaryrefslogtreecommitdiffstats
path: root/src/shell/inputs/mod.rs
blob: 48590a25289d774c6965d341494f4937d54e5cb2 (plain) (blame)
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
use crate::shell::prelude::*;

mod clock;
mod git;
pub use git::Info as GitInfo;
mod signals;
mod stdin;

pub struct Handler {
    _clock: clock::Handler,
    git: git::Handler,
    _signals: signals::Handler,
    _stdin: stdin::Handler,
}

impl Handler {
    pub fn new(
        input: textmode::blocking::Input,
        event_w: crate::shell::event::Writer,
    ) -> Result<Self> {
        Ok(Self {
            _clock: clock::Handler::new(event_w.clone()),
            git: git::Handler::new(event_w.clone()),
            _signals: signals::Handler::new(event_w.clone())?,
            _stdin: stdin::Handler::new(input, event_w),
        })
    }

    pub fn new_dir(&self, path: std::path::PathBuf) {
        self.git.new_dir(path);
    }
}