diff options
author | Cyril Plisko <cyril.plisko@mountall.com> | 2017-12-11 21:12:07 +0200 |
---|---|---|
committer | Cyril Plisko <cyril.plisko@mountall.com> | 2017-12-11 21:33:12 +0200 |
commit | 177ddf19770c7453f8e4de16d1b39e610faf248a (patch) | |
tree | 11ddc4c149a338f1315e63e1269e7b42a549bdeb | |
parent | e540854e602b80363031e2a26251c7e71eae17cd (diff) |
Deprecate 'Pager::skip_on_notty()'
-rw-r--r-- | src/lib.rs | 10 | ||||
-rw-r--r-- | tests/pager.rs | 11 |
2 files changed, 19 insertions, 2 deletions
@@ -126,6 +126,7 @@ impl Pager { } /// Instructs `Pager` to bypass invoking pager if output is not a `tty` + #[deprecated(since = "0.14.0", note = "'skip_on_notty' is default now")] pub fn skip_on_notty(self) -> Self { Self { skip_on_notty: true, @@ -133,6 +134,15 @@ impl Pager { } } + /// Instructs `Pager` to force invoking pager even if output is not a `tty` + #[doc(hidden)] + pub fn force_on_notty(self) -> Self { + Self { + skip_on_notty: false, + ..self + } + } + /// Gives quick assessment of successful `Pager` setup pub fn is_on(&self) -> bool { self.on diff --git a/tests/pager.rs b/tests/pager.rs index b9ca62f..8cc8a3c 100644 --- a/tests/pager.rs +++ b/tests/pager.rs @@ -14,8 +14,15 @@ fn nopager() { } #[test] -fn notty() { - let mut pager = Pager::new().skip_on_notty(); +fn skip_on_notty() { + let mut pager = Pager::new(); pager.setup(); assert!(!pager.is_on()); } + +#[test] +fn force_on_notty() { + let mut pager = Pager::new().force_on_notty(); + pager.setup(); + assert!(pager.is_on()); +} |