Skip to content

Commit 27be74d

Browse files
committed
feat: make is_terminal replaceable with std via cfg
1 parent b4892d4 commit 27be74d

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

Cargo.toml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,9 @@ maintenance = { status = "passively-maintained" }
2525

2626
[features]
2727
# TODO: use `dep:` syntax here and below once MSRV is at least `1.60`
28-
default = ["win_crlf", "csv", "legacy-is-terminal"]
28+
default = ["win_crlf", "csv"]
2929
evcxr = []
3030
win_crlf = []
31-
# This feature is inentionally opt-out (enabled by default) not to break older clients,
32-
# although it may become no-op with a MSRV bummp (which is considered a minor change) and removed with a major update
33-
# TODO: make this feature no-op once MSRV is at least `1.70`
34-
legacy-is-terminal = ["is-terminal"]
3531

3632
[[bin]]
3733
name = "main"
@@ -45,6 +41,9 @@ name = "prettytable"
4541
unicode-width = "0.1"
4642
term = "0.7"
4743
lazy_static = "1.4"
48-
is-terminal = { version = "0.4", optional = true }
4944
encode_unicode = "1.0"
5045
csv = { version = "1.1", optional = true }
46+
47+
# TODO: remove it once MSRV is at least `1.70`
48+
[target.'cfg(not(prettytable_is_terminal_implementation = "std"))'.dependencies]
49+
is-terminal = "0.4"

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,9 @@ impl<'a> TableSlice<'a> {
194194
/// # Returns
195195
/// A `Result` holding the number of lines printed, or an `io::Error` if any failure happens
196196
pub fn print_tty(&self, force_colorize: bool) -> Result<usize, Error> {
197-
#[cfg(not(feature = "legacy-is-terminal"))]
197+
#[cfg(prettytable_is_terminal_implementation = "std")]
198198
use std::io::IsTerminal;
199-
#[cfg(feature = "legacy-is-terminal")]
199+
#[cfg(not(prettytable_is_terminal_implementation = "std"))]
200200
use is_terminal::IsTerminal;
201201

202202
match (stdout(), io::stdout().is_terminal() || force_colorize) {

0 commit comments

Comments
 (0)