From 3d2d5b4be755f0bea7ebd92759d930191514297f Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Mon, 29 Jun 2020 18:10:59 -0400 Subject: Trivial changes --- src/cli.rs | 14 +++++++++++++- src/config.rs | 2 +- src/main.rs | 3 ++- src/options/rewrite.rs | 10 ---------- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/cli.rs b/src/cli.rs index e8c48654..1855d660 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -7,11 +7,13 @@ use itertools; use lazy_static::lazy_static; use structopt::clap::AppSettings::{ColorAlways, ColoredHelp, DeriveDisplayOrder}; use structopt::{clap, StructOpt}; +use syntect::highlighting::Theme as SyntaxTheme; +use syntect::parsing::SyntaxSet; use crate::git_config::GitConfig; use crate::options; -#[derive(StructOpt, Clone, Debug, PartialEq)] +#[derive(StructOpt, Clone)] #[structopt( name = "delta", about = "A viewer for git and diff output", @@ -495,6 +497,16 @@ pub struct Opt { #[structopt(long = "theme")] /// Deprecated: use --syntax-theme. pub deprecated_theme: Option, + #[structopt(skip)] + pub computed: ComputedValues, +} + +#[derive(Default, Clone, Debug)] +pub struct ComputedValues { + pub is_light_mode: bool, + pub syntax_set: SyntaxSet, + pub syntax_theme: Option, + pub syntax_dummy_theme: SyntaxTheme, } impl Opt { diff --git a/src/config.rs b/src/config.rs index a0015f71..f790e7dc 100644 --- a/src/config.rs +++ b/src/config.rs @@ -478,10 +478,10 @@ fn is_truecolor_terminal() -> bool { #[cfg(test)] mod tests { - use super::*; use std::env; use crate::color; + use crate::syntax_theme; use crate::tests::integration_test_utils::integration_test_utils; #[test] diff --git a/src/main.rs b/src/main.rs index 3c56cb00..dc734319 100644 --- a/src/main.rs +++ b/src/main.rs @@ -247,7 +247,8 @@ index f38589a..0f1bb83 100644 +fn print_cube(num: f64) { + let result = f64::powf(num, 3.0); + println!(\"The cube of {:.2} is {:.2}.\", num, result); - }" + } +" .to_vec() }; diff --git a/src/options/rewrite.rs b/src/options/rewrite.rs index 076298f7..c1f349d7 100644 --- a/src/options/rewrite.rs +++ b/src/options/rewrite.rs @@ -195,16 +195,6 @@ mod tests { use crate::cli; use crate::options::rewrite::apply_rewrite_rules; - #[test] - fn test_default_is_stable_under_rewrites() { - let mut opt = cli::Opt::from_iter(Vec::::new()); - let before = opt.clone(); - - apply_rewrite_rules(&mut opt, &clap::ArgMatches::new()); - - assert_eq!(opt, before); - } - /// Since --hunk-header-decoration-style is at its default value of "box", /// the deprecated option is allowed to overwrite it. #[test] -- cgit v1.2.3