summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Davison <dandavison7@gmail.com>2020-06-20 23:28:16 -0400
committerDan Davison <dandavison7@gmail.com>2020-06-20 23:28:16 -0400
commit50744ccd52320cb332fba1ffa413b93965789906 (patch)
tree2a808b2354f5c36f1c172dd5ce5fbc849f588646
parent7d36236e929d24a84fcac02985ab607a5eef4806 (diff)
Rename type
-rw-r--r--src/features/diff_highlight.rs6
-rw-r--r--src/features/diff_so_fancy.rs4
-rw-r--r--src/features/mod.rs6
-rw-r--r--src/features/navigate.rs4
-rw-r--r--src/set_options.rs13
5 files changed, 17 insertions, 16 deletions
diff --git a/src/features/diff_highlight.rs b/src/features/diff_highlight.rs
index e339474b..35b71c4b 100644
--- a/src/features/diff_highlight.rs
+++ b/src/features/diff_highlight.rs
@@ -1,10 +1,10 @@
-use crate::features::FeatureValueFunction;
+use crate::features::OptionValueFunction;
-pub fn make_feature() -> Vec<(String, FeatureValueFunction)> {
+pub fn make_feature() -> Vec<(String, OptionValueFunction)> {
_make_feature(false)
}
-pub fn _make_feature(bold: bool) -> Vec<(String, FeatureValueFunction)> {
+pub fn _make_feature(bold: bool) -> Vec<(String, OptionValueFunction)> {
builtin_feature!([
(
"minus-style",
diff --git a/src/features/diff_so_fancy.rs b/src/features/diff_so_fancy.rs
index 0013ef37..8b7d0299 100644
--- a/src/features/diff_so_fancy.rs
+++ b/src/features/diff_so_fancy.rs
@@ -1,7 +1,7 @@
use crate::features::diff_highlight;
-use crate::features::FeatureValueFunction;
+use crate::features::OptionValueFunction;
-pub fn make_feature() -> Vec<(String, FeatureValueFunction)> {
+pub fn make_feature() -> Vec<(String, OptionValueFunction)> {
let mut feature = diff_highlight::_make_feature(true);
feature.extend(builtin_feature!([
(
diff --git a/src/features/mod.rs b/src/features/mod.rs
index 7f7add46..4232cd4e 100644
--- a/src/features/mod.rs
+++ b/src/features/mod.rs
@@ -14,9 +14,9 @@ use crate::git_config::GitConfig;
/// A builtin feature is a named set of command line (option, value) pairs that is built in to
/// delta. The implementation stores each value as a function, which allows the value (a) to depend
/// dynamically on the value of other command line options, and (b) to be taken from git config.
-pub type BuiltinFeature = HashMap<String, FeatureValueFunction>;
+pub type BuiltinFeature = HashMap<String, OptionValueFunction>;
-type FeatureValueFunction = Box<dyn Fn(&cli::Opt, &Option<GitConfig>) -> OptionValue>;
+type OptionValueFunction = Box<dyn Fn(&cli::Opt, &Option<GitConfig>) -> OptionValue>;
pub enum OptionValue {
Boolean(bool),
@@ -64,7 +64,7 @@ macro_rules! builtin_feature {
_ => None,
}
.unwrap_or_else(|| $value.into())
- }) as FeatureValueFunction
+ }) as OptionValueFunction
)
),*]
}
diff --git a/src/features/navigate.rs b/src/features/navigate.rs
index 111f9167..a5839486 100644
--- a/src/features/navigate.rs
+++ b/src/features/navigate.rs
@@ -1,9 +1,9 @@
/// Activate diff navigation: use n to jump forwards and N to jump backwards. To change the
/// file labels used see --file-modified-label, --file-removed-label, --file-added-label,
/// --file-renamed-label.
-use crate::features::FeatureValueFunction;
+use crate::features::OptionValueFunction;
-pub fn make_feature() -> Vec<(String, FeatureValueFunction)> {
+pub fn make_feature() -> Vec<(String, OptionValueFunction)> {
builtin_feature!([
(
"navigate",
diff --git a/src/set_options.rs b/src/set_options.rs
index 6fdbedae..a6ca9dfe 100644
--- a/src/set_options.rs
+++ b/src/set_options.rs
@@ -9,14 +9,15 @@ use crate::git_config::{self, GitConfigGet};
// A type T implementing this trait gains a static method allowing an option value of type T to be
// looked up, implementing delta's rules for looking up option values.
trait GetOptionValue {
- // If the value for option name n was not supplied on the command line, then a search is performed
+ // If the value for option name k was not supplied on the command line, then a search is performed
// as follows. The first value encountered is used:
//
- // 1. For each feature p (moving right to left through the listed features):
- // 1.1 The value of n under p interpreted as a user-supplied feature (i.e. git config value
- // delta.$p.$n)
- // 1.2 The value for n under p interpreted as a builtin feature
- // 3. The value for n in the main git config section for delta (i.e. git config value delta.$n)
+ // 1. For each feature f (moving right to left through the listed features):
+ // 1.1 The value of k under f interpreted as a user-supplied feature (i.e. git config value
+ // delta.f.k)
+ // 1.2 The value for k under f interpreted as a builtin feature
+ // 2. The value for k in the main git config section for delta (i.e. git config value delta.k)
+ // 3. The default value for k.
fn get_option_value(
option_name: &str,
builtin_features: &HashMap<String, features::BuiltinFeature>,