mcfly 0.5.3

McFly replaces your default ctrl-r shell history search with an intelligent search engine that takes into account your working directory and the context of recently executed commands. McFly's suggestions are prioritized in real time with a small neural network.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
// Should we be using https://docs.rs/libc/0.2.44/libc/fn.ioctl.html instead?
extern "C" {
    pub fn ioctl(fd: i8, request: u32, arg: *const u8) -> i8;
}

pub fn use_tiocsti(string: &str) {
    for byte in string.as_bytes() {
        let a: *const u8 = byte;
        if unsafe { ioctl(0, libc::TIOCSTI as u32, a) } < 0 {
            panic!("Error encountered when calling ioctl");
        }
    }
}