summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Davison <dandavison7@gmail.com>2020-06-29 18:10:59 -0400
committerDan Davison <dandavison7@gmail.com>2020-06-30 08:00:30 -0400
commit3d2d5b4be755f0bea7ebd92759d930191514297f (patch)
treef3829fe7d5d645f542fd209b5e8a4d3eaca17fcc
parentf5c7053fdbedebb512151346a7eefd2b7d3565c9 (diff)
Trivial changes
-rw-r--r--src/cli.rs14
-rw-r--r--src/config.rs2
-rw-r--r--src/main.rs3
-rw-r--r--src/options/rewrite.rs10
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<String>,
+ #[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<SyntaxTheme>,
+ 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::<OsString>::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]