Commit 177ddf19 authored by Cyril Plisko's avatar Cyril Plisko 🤔

Deprecate 'Pager::skip_on_notty()'

parent e540854e
Pipeline #14984486 failed with stage
in 1 minute and 10 seconds
......@@ -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
......
......@@ -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());
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment