aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaibo Huang <hhb@google.com>2020-11-19 06:58:29 -0800
committerHaibo Huang <hhb@google.com>2020-11-19 06:58:29 -0800
commit3128b854ea9a738383125c56daf6209910fd4b9d (patch)
treef6c0c09d7f4afdda1594666a5b43cdf492e51534
parentbc625adc38aa4760c976e64d44f004d58dfaffa1 (diff)
downloadtermcolor-3128b854ea9a738383125c56daf6209910fd4b9d.tar.gz
Upgrade rust/crates/termcolor to 1.1.2
Test: make Change-Id: Ied6674c9b818beb26ffc8b6cbbe705da89f1ec2c
-rw-r--r--.cargo_vcs_info.json2
-rw-r--r--Cargo.toml6
-rw-r--r--Cargo.toml.orig6
-rw-r--r--METADATA8
-rw-r--r--src/lib.rs49
5 files changed, 49 insertions, 22 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index 6cc0751..c0bf7bd 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,5 +1,5 @@
{
"git": {
- "sha1": "1679b36fa77be176e9d4ca9e7278be16bc0c7de5"
+ "sha1": "949875368995c00bef275dc8c554f5b34bc35a05"
}
}
diff --git a/Cargo.toml b/Cargo.toml
index 9d030e1..344e18b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,7 +13,7 @@
[package]
edition = "2018"
name = "termcolor"
-version = "1.1.0"
+version = "1.1.2"
authors = ["Andrew Gallant <jamslam@gmail.com>"]
exclude = ["/.travis.yml", "/appveyor.yml", "/ci/**"]
description = "A simple cross platform library for writing colored text to a terminal.\n"
@@ -27,7 +27,7 @@ repository = "https://github.com/BurntSushi/termcolor"
[lib]
name = "termcolor"
bench = false
-[dev-dependencies.doc-comment]
-version = "0.3"
+
+[dev-dependencies]
[target."cfg(windows)".dependencies.winapi-util]
version = "0.1.3"
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index 622d2f4..1e9f5d3 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,6 +1,6 @@
[package]
name = "termcolor"
-version = "1.1.0" #:version
+version = "1.1.2" #:version
authors = ["Andrew Gallant <jamslam@gmail.com>"]
description = """
A simple cross platform library for writing colored text to a terminal.
@@ -22,4 +22,6 @@ bench = false
winapi-util = "0.1.3"
[dev-dependencies]
-doc-comment = "0.3"
+# TODO: Re-enable this once the MSRV is 1.43 or greater.
+# See: https://github.com/BurntSushi/termcolor/issues/35
+# doc-comment = "0.3"
diff --git a/METADATA b/METADATA
index 16a1673..eab3cf6 100644
--- a/METADATA
+++ b/METADATA
@@ -7,13 +7,13 @@ third_party {
}
url {
type: ARCHIVE
- value: "https://static.crates.io/crates/termcolor/termcolor-1.1.0.crate"
+ value: "https://static.crates.io/crates/termcolor/termcolor-1.1.2.crate"
}
- version: "1.1.0"
+ version: "1.1.2"
license_type: NOTICE
last_upgrade_date {
year: 2020
- month: 5
- day: 6
+ month: 11
+ day: 19
}
}
diff --git a/src/lib.rs b/src/lib.rs
index 42eccda..735ce97 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -119,10 +119,10 @@ Currently, `termcolor` does not provide anything to do this for you.
#![deny(missing_docs)]
-#[cfg(test)]
-use doc_comment::doctest;
-#[cfg(test)]
-doctest!("../README.md");
+// #[cfg(doctest)]
+// use doc_comment::doctest;
+// #[cfg(doctest)]
+// doctest!("../README.md");
use std::env;
use std::error;
@@ -1306,6 +1306,9 @@ impl<W: io::Write> WriteColor for Ansi<W> {
if spec.bold {
self.write_str("\x1B[1m")?;
}
+ if spec.dimmed {
+ self.write_str("\x1B[2m")?;
+ }
if spec.italic {
self.write_str("\x1B[3m")?;
}
@@ -1566,6 +1569,7 @@ pub struct ColorSpec {
bold: bool,
intense: bool,
underline: bool,
+ dimmed: bool,
italic: bool,
reset: bool,
}
@@ -1578,6 +1582,7 @@ impl Default for ColorSpec {
bold: false,
intense: false,
underline: false,
+ dimmed: false,
italic: false,
reset: true,
}
@@ -1627,6 +1632,21 @@ impl ColorSpec {
self
}
+ /// Get whether this is dimmed or not.
+ ///
+ /// Note that the dimmed setting has no effect in a Windows console.
+ pub fn dimmed(&self) -> bool {
+ self.dimmed
+ }
+
+ /// Set whether the text is dimmed or not.
+ ///
+ /// Note that the dimmed setting has no effect in a Windows console.
+ pub fn set_dimmed(&mut self, yes: bool) -> &mut ColorSpec {
+ self.dimmed = yes;
+ self
+ }
+
/// Get whether this is italic or not.
///
/// Note that the italic setting has no effect in a Windows console.
@@ -1715,6 +1735,7 @@ impl ColorSpec {
&& self.bg_color.is_none()
&& !self.bold
&& !self.underline
+ && !self.dimmed
&& !self.italic
&& !self.intense
}
@@ -1726,6 +1747,7 @@ impl ColorSpec {
self.bold = false;
self.underline = false;
self.intense = false;
+ self.dimmed = false;
self.italic = false;
}
@@ -2180,14 +2202,17 @@ mod tests {
for underline in vec![false, true] {
for intense in vec![false, true] {
for italic in vec![false, true] {
- let mut color = ColorSpec::new();
- color.set_fg(fg);
- color.set_bg(bg);
- color.set_bold(bold);
- color.set_underline(underline);
- color.set_intense(intense);
- color.set_italic(italic);
- result.push(color);
+ for dimmed in vec![false, true] {
+ let mut color = ColorSpec::new();
+ color.set_fg(fg);
+ color.set_bg(bg);
+ color.set_bold(bold);
+ color.set_underline(underline);
+ color.set_intense(intense);
+ color.set_dimmed(dimmed);
+ color.set_italic(italic);
+ result.push(color);
+ }
}
}
}