Skip to content
Myr

Detect interactive terminal, closes #11

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by sharkdp · committed by sharkdp · parent e43353a · Browse files · 3 files+23 added−7 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+23 added−7 removed

  • other:+23 added−7 removed

3 files+23 added−7 removed

modified:src/main.rs+10 added-7 removed
1extern crate walkdir;2extern crate regex;3extern crate getopts;1extern crate ansi_term;2extern crate getopts;3extern crate isatty;4extern crate regex;5extern crate walkdir;67use std::env;8use std::error::Error;9use std::ffi::OsStr;10use std::io::Write;11use std::path::Path;12use std::process;1313use walkdir::{WalkDir, DirEntry, WalkDirIterator};14use regex::{Regex, RegexBuilder};15use getopts::Options;14use ansi_term::Colour;15use getopts::Options;16use isatty::stdout_isatty;17use regex::{Regex, RegexBuilder};18use walkdir::{WalkDir, DirEntry, WalkDirIterator};1920struct FdOptions {21 case_sensitive: bool,22 search_full_path: bool,
108 unmodified lines
131 case_sensitive: matches.opt_present("sensitive") ||132 pattern.chars().any(char::is_uppercase),133 search_full_path: !matches.opt_present("filename"),134 search_hidden: matches.opt_present("hidden"),133 colored: !matches.opt_present("no-color"),135 colored: !matches.opt_present("no-color") &&136 stdout_isatty(),137 follow_links: matches.opt_present("follow"),138 max_depth:139 matches.opt_str("max-depth")140 .and_then(|ds| usize::from_str_radix(&ds, 10).ok())
10 unmodified lines
modified:Cargo.lock+12 added
2 unmodified lines
3version = "0.1.0"4dependencies = [5 "ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",6 "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",7 "isatty 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",8 "regex 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",9 "walkdir 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)",10]11
15 unmodified lines
27version = "0.2.14"28source = "registry+https://github.com/rust-lang/crates.io-index"2930[[package]]31name = "isatty"32version = "0.1.3"33source = "registry+https://github.com/rust-lang/crates.io-index"34dependencies = [35 "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",36 "libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",37 "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",38]3940[[package]]41name = "kernel32-sys"42version = "0.2.2"43source = "registry+https://github.com/rust-lang/crates.io-index"44dependencies = [
99 unmodified lines
144[metadata]145"checksum aho-corasick 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "500909c4f87a9e52355b26626d890833e9e1d53ac566db76c36faa984b889699"146"checksum ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "23ac7c30002a5accbf7e8987d0632fa6de155b7c3d39d0067317a391e00a2ef6"147"checksum getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9047cfbd08a437050b363d35ef160452c5fe8ea5187ae0a624708c91581d685"148"checksum isatty 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "fa500db770a99afe2a0f2229be2a3d09c7ed9d7e4e8440bf71253141994e240f"149"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"150"checksum libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)" = "babb8281da88cba992fa1f4ddec7d63ed96280a1a53ec9b919fd37b53d71e502"151"checksum memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1dbccc0e46f1ea47b9f17e6d67c5a96bd27030519c519c9c91327e31275a47b4"152"checksum regex 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4278c17d0f6d62dfef0ab00028feb45bd7d2102843f80763474eeb1be8a10c01"
10 unmodified lines
modified:Cargo.toml+1 added