From 9349373cd8f08cb8639535d4c580d7b98bc29843 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Mon, 29 Jun 2020 18:14:04 -0400 Subject: Pass HighlightingAssets --- src/cli.rs | 12 +++++++++--- src/main.rs | 3 ++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/cli.rs b/src/cli.rs index 1855d660..0d743e6e 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -10,6 +10,7 @@ use structopt::{clap, StructOpt}; use syntect::highlighting::Theme as SyntaxTheme; use syntect::parsing::SyntaxSet; +use crate::bat::assets::HighlightingAssets; use crate::git_config::GitConfig; use crate::options; @@ -510,8 +511,11 @@ pub struct ComputedValues { } impl Opt { - pub fn from_args_and_git_config(git_config: &mut Option) -> Self { - Self::from_clap_and_git_config(Self::clap().get_matches(), git_config) + pub fn from_args_and_git_config( + git_config: &mut Option, + assets: HighlightingAssets, + ) -> Self { + Self::from_clap_and_git_config(Self::clap().get_matches(), git_config, assets) } #[cfg(test)] @@ -520,12 +524,14 @@ impl Opt { I: IntoIterator, I::Item: Into + Clone, { - Self::from_clap_and_git_config(Self::clap().get_matches_from(iter), git_config) + let assets = HighlightingAssets::new(); + Self::from_clap_and_git_config(Self::clap().get_matches_from(iter), git_config, assets) } fn from_clap_and_git_config( arg_matches: clap::ArgMatches, git_config: &mut Option, + assets: HighlightingAssets, ) -> Self { let mut opt = Opt::from_clap(&arg_matches); options::set::set_options(&mut opt, git_config, &arg_matches); diff --git a/src/main.rs b/src/main.rs index dc734319..a70b83c3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -47,7 +47,8 @@ mod errors { } fn main() -> std::io::Result<()> { - let opt = cli::Opt::from_args_and_git_config(&mut git_config::GitConfig::try_create()); + let assets = HighlightingAssets::new(); + let opt = cli::Opt::from_args_and_git_config(&mut git_config::GitConfig::try_create(), assets); if opt.list_languages { list_languages()?; -- cgit v1.2.3