dejavu/exec/
interactive.rs1use std::io::IsTerminal;
4
5pub fn stdin_is_tty() -> bool {
6 std::io::stdin().is_terminal()
7}
8
9pub fn has_watch_flag(args: &[String]) -> bool {
12 args.iter()
13 .any(|a| matches!(a.as_str(), "--watch" | "--watchAll" | "--watch=true"))
14}
15
16pub fn is_known_interactive(shim: &str, subcommand: Option<&str>) -> bool {
18 matches!(
19 (shim, subcommand),
20 ("npm", Some("init"))
21 | ("npm", Some("login"))
22 | ("npm", Some("adduser"))
23 | ("yarn", Some("login"))
24 | ("docker", Some("exec"))
25 | ("docker", Some("attach"))
26 )
27}