Commit 798decbf authored by Cyril Plisko's avatar Cyril Plisko 🤔

Introduce with_env() and deprecate env()

parent 4ab2de40
Pipeline #9606938 passed with stage
in 1 minute and 17 seconds
......@@ -25,7 +25,7 @@
//! extern crate pager;
//! use pager::Pager;
//! fn main() {
//! Pager::env("MY_PAGER").setup();
//! Pager::with_env("MY_PAGER").setup();
//! // The rest of your program goes here
//! }
//! ```
......@@ -72,11 +72,11 @@ pub struct Pager {
impl Pager {
/// Creates new instance of pager with default settings
pub fn new() -> Self {
Pager::env(DEFAULT_PAGER_ENV)
Pager::with_env(DEFAULT_PAGER_ENV)
}
/// Creates new instance of pager using `env` environment variable instead of PAGER
pub fn env(env: &str) -> Self {
pub fn with_env(env: &str) -> Self {
let pager = utils::find_pager(env);
Pager {
......@@ -86,6 +86,11 @@ impl Pager {
}
}
#[deprecated(since = "0.12.0", note = "use with_env() instead")]
pub fn env(env: &str) -> Self {
Pager::with_env(env)
}
/// Creates a new pager instance directly specifying the desired pager
pub fn with_pager(pager: &str) -> Self {
Pager {
......
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