From f034be71e7c1e8336d04ad3c6fdedca899c37d63 Mon Sep 17 00:00:00 2001 From: sharkdp Date: Wed, 22 Apr 2020 20:33:19 +0200 Subject: [PATCH] rename run => print --- examples/cat.rs | 2 +- examples/simple.rs | 2 +- src/lib.rs | 7 ++++--- src/pretty_printer.rs | 6 +++--- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/examples/cat.rs b/examples/cat.rs index c1c9b242..5111a086 100644 --- a/examples/cat.rs +++ b/examples/cat.rs @@ -12,6 +12,6 @@ fn main() { StyleComponent::Numbers, ])) .input_files(std::env::args_os().skip(1)) - .run() + .print() .expect("no errors"); } diff --git a/examples/simple.rs b/examples/simple.rs index c30cbd2a..8459c6ab 100644 --- a/examples/simple.rs +++ b/examples/simple.rs @@ -7,6 +7,6 @@ fn main() { PrettyPrinter::new() .input_file(path_to_this_file) - .run() + .print() .expect("no errors"); } diff --git a/src/lib.rs b/src/lib.rs index db7ce543..2b14c11e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,10 +1,11 @@ //! `bat` is a library to print syntax highlighted content. //! -//! The main struct is `PrettyPrinter` which can be used to configure and -//! run the syntax highlighting. +//! The main struct of this crate is `PrettyPrinter` which can be used to +//! configure and run the syntax highlighting. +//! //! If you need more control, you can also use the structs in the submodules //! (start with `controller::Controller`), but note that the API of these -//! internal modules much more likely to change. +//! internal modules is much more likely to change. //! //! "Hello world" example: //! ``` diff --git a/src/pretty_printer.rs b/src/pretty_printer.rs index 67a4ee59..91d5be54 100644 --- a/src/pretty_printer.rs +++ b/src/pretty_printer.rs @@ -160,10 +160,10 @@ impl<'a> PrettyPrinter<'a> { self } - /// Pretty-print all specified inputs. This method will drain all stored inputs. - /// If you want to call 'run' multiple times, you have to call the appropriate + /// Pretty-print all specified inputs. This method will "use" all stored inputs. + /// If you want to call 'print' multiple times, you have to call the appropriate /// input_* methods again. - pub fn run(&mut self) -> Result { + pub fn print(&mut self) -> Result { self.config.highlighted_lines = HighlightedLineRanges(LineRanges::from(self.highlighted_lines.clone()));