rename run => print

This commit is contained in:
sharkdp 2020-04-22 20:33:19 +02:00 committed by David Peter
parent eee35e54e9
commit f034be71e7
4 changed files with 9 additions and 8 deletions

View File

@ -12,6 +12,6 @@ fn main() {
StyleComponent::Numbers,
]))
.input_files(std::env::args_os().skip(1))
.run()
.print()
.expect("no errors");
}

View File

@ -7,6 +7,6 @@ fn main() {
PrettyPrinter::new()
.input_file(path_to_this_file)
.run()
.print()
.expect("no errors");
}

View File

@ -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:
//! ```

View File

@ -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<bool> {
pub fn print(&mut self) -> Result<bool> {
self.config.highlighted_lines =
HighlightedLineRanges(LineRanges::from(self.highlighted_lines.clone()));