summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Davison <dandavison7@gmail.com>2020-06-29 18:14:04 -0400
committerDan Davison <dandavison7@gmail.com>2020-06-30 08:00:30 -0400
commit9349373cd8f08cb8639535d4c580d7b98bc29843 (patch)
tree4ab8e4220a8996db348baadfff9d3b2194da8f8f
parent3d2d5b4be755f0bea7ebd92759d930191514297f (diff)
Pass HighlightingAssets
-rw-r--r--src/cli.rs12
-rw-r--r--src/main.rs3
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<GitConfig>) -> Self {
- Self::from_clap_and_git_config(Self::clap().get_matches(), git_config)
+ pub fn from_args_and_git_config(
+ git_config: &mut Option<GitConfig>,
+ 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<OsString> + 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<GitConfig>,
+ 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()?;