mirror of
https://github.com/sharkdp/bat.git
synced 2025-09-01 19:02:22 +01:00
Add syntaxes and themes method
This commit is contained in:
@@ -164,8 +164,8 @@ impl HighlightingAssets {
|
||||
self.syntax_set.syntaxes()
|
||||
}
|
||||
|
||||
pub fn themes(&self) -> impl Iterator<Item = &String> {
|
||||
self.theme_set.themes.keys()
|
||||
pub fn themes(&self) -> impl Iterator<Item = &str> {
|
||||
self.theme_set.themes.keys().map(|s| s.as_ref())
|
||||
}
|
||||
|
||||
pub(crate) fn get_theme(&self, theme: &str) -> &Theme {
|
||||
|
@@ -2,6 +2,7 @@ use std::ffi::OsStr;
|
||||
use std::io::Read;
|
||||
|
||||
use console::Term;
|
||||
use syntect::parsing::SyntaxReference;
|
||||
|
||||
use crate::{
|
||||
assets::HighlightingAssets,
|
||||
@@ -201,6 +202,14 @@ impl<'a> PrettyPrinter<'a> {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn themes(&self) -> impl Iterator<Item = &str> {
|
||||
self.assets.themes()
|
||||
}
|
||||
|
||||
pub fn syntaxes(&self) -> impl Iterator<Item = &SyntaxReference> {
|
||||
self.assets.syntaxes().iter()
|
||||
}
|
||||
|
||||
/// 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.
|
||||
|
Reference in New Issue
Block a user