diff options
author | Haibo Huang <hhb@google.com> | 2020-11-23 10:52:35 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-11-23 10:52:35 +0000 |
commit | b0081528dc99bc24f9447f719ba0c039616f81ca (patch) | |
tree | f6c0c09d7f4afdda1594666a5b43cdf492e51534 | |
parent | f4cb3aa9fa9781181452bf6eb82d222721718f85 (diff) | |
parent | 050af3191ec06358ec5c70a2411295ff2e29cb4d (diff) | |
download | termcolor-b0081528dc99bc24f9447f719ba0c039616f81ca.tar.gz |
Upgrade rust/crates/termcolor to 1.1.2 am: 3128b854ea am: ce1a0d1d89 am: 050af3191e
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/termcolor/+/1505811
Change-Id: If9224032263f20345855bd273e0ae6a14a1fcfff
-rw-r--r-- | .cargo_vcs_info.json | 2 | ||||
-rw-r--r-- | Cargo.toml | 6 | ||||
-rw-r--r-- | Cargo.toml.orig | 6 | ||||
-rw-r--r-- | METADATA | 8 | ||||
-rw-r--r-- | src/lib.rs | 49 |
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" } } @@ -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" @@ -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 } } @@ -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); + } } } } |