1
0
mirror of https://github.com/sharkdp/bat.git synced 2025-01-31 02:01:05 +00:00

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, StyleComponent::Numbers,
])) ]))
.input_files(std::env::args_os().skip(1)) .input_files(std::env::args_os().skip(1))
.run() .print()
.expect("no errors"); .expect("no errors");
} }

View File

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

View File

@ -1,10 +1,11 @@
//! `bat` is a library to print syntax highlighted content. //! `bat` is a library to print syntax highlighted content.
//! //!
//! The main struct is `PrettyPrinter` which can be used to configure and //! The main struct of this crate is `PrettyPrinter` which can be used to
//! run the syntax highlighting. //! configure and run the syntax highlighting.
//!
//! If you need more control, you can also use the structs in the submodules //! 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 //! (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: //! "Hello world" example:
//! ``` //! ```

View File

@ -160,10 +160,10 @@ impl<'a> PrettyPrinter<'a> {
self self
} }
/// Pretty-print all specified inputs. This method will drain all stored inputs. /// Pretty-print all specified inputs. This method will "use" all stored inputs.
/// If you want to call 'run' multiple times, you have to call the appropriate /// If you want to call 'print' multiple times, you have to call the appropriate
/// input_* methods again. /// input_* methods again.
pub fn run(&mut self) -> Result<bool> { pub fn print(&mut self) -> Result<bool> {
self.config.highlighted_lines = self.config.highlighted_lines =
HighlightedLineRanges(LineRanges::from(self.highlighted_lines.clone())); HighlightedLineRanges(LineRanges::from(self.highlighted_lines.clone()));