Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ keywords = ["tab", "table", "format", "pretty", "print"]
categories = ["command-line-interface"]
license = "BSD-3-Clause"
edition = "2018"
rust-version = "1.56.1"
exclude = [
"prettytable-evcxr.png"
]
Expand All @@ -23,6 +24,7 @@ codecov = { repository = "phsym/prettytable-rs", branch = "master", service = "g
maintenance = { status = "passively-maintained" }

[features]
# TODO: use `dep:` syntax here and below once MSRV is at least `1.60`
default = ["win_crlf", "csv"]
evcxr = []
win_crlf = []
Expand All @@ -39,6 +41,9 @@ name = "prettytable"
unicode-width = "0.1"
term = "0.7"
lazy_static = "1.4"
is-terminal = "0.4"
encode_unicode = "1.0"
csv = { version = "1.1", optional = true }

# TODO: remove it once MSRV is at least `1.70`
[target.'cfg(not(prettytable_is_terminal_implementation = "std"))'.dependencies]
is-terminal = "0.4"
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,11 @@ impl<'a> TableSlice<'a> {
/// # Returns
/// A `Result` holding the number of lines printed, or an `io::Error` if any failure happens
pub fn print_tty(&self, force_colorize: bool) -> Result<usize, Error> {
#[cfg(prettytable_is_terminal_implementation = "std")]
use std::io::IsTerminal;
#[cfg(not(prettytable_is_terminal_implementation = "std"))]
use is_terminal::IsTerminal;

match (stdout(), io::stdout().is_terminal() || force_colorize) {
(Some(mut o), true) => self.print_term(&mut *o),
_ => self.print(&mut io::stdout()),
Expand Down