use std::io::{IsTerminal, stdin};

pub trait IsATerminal {
    fn is_a_terminal(&self) -> bool;
}

impl IsATerminal for std::io::Stdin {
    fn is_a_terminal(&self) -> bool {
        stdin().is_terminal()
    }
}

pub struct FakeStdin {
    is_terminal: bool,
}

impl FakeStdin {
    pub fn new(is_terminal: bool) -> Self {
        Self { is_terminal }
    }
}

impl IsATerminal for FakeStdin {
    fn is_a_terminal(&self) -> bool {
        self.is_terminal
    }
}
