diff options
author | Dan Davison <dandavison7@gmail.com> | 2020-06-21 18:24:16 -0400 |
---|---|---|
committer | Dan Davison <dandavison7@gmail.com> | 2020-06-21 21:17:56 -0400 |
commit | 8f2df66af2275cd76dce644f396f0473b1544526 (patch) | |
tree | 2bcddc50e29177b0e7543e428dd2680fb0401ac4 | |
parent | ab087f7d2cbbfb1e0ee74e99496c3901b84a2305 (diff) |
Reinstate --navigate flag
-rw-r--r-- | src/cli.rs | 6 | ||||
-rw-r--r-- | src/features/navigate.rs | 7 | ||||
-rw-r--r-- | src/set_options.rs | 3 |
3 files changed, 11 insertions, 5 deletions
@@ -244,8 +244,10 @@ pub struct Opt { /// of the special attributes 'box', 'ul', 'overline', or 'underoverline' must be given. pub file_decoration_style: String, - #[structopt(skip = false)] - /// Navigate feature: users enable the feature by adding "navigate" to their feature list. + #[structopt(long = "navigate")] + /// 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. pub navigate: bool, #[structopt(long = "file-modified-label", default_value = "")] diff --git a/src/features/navigate.rs b/src/features/navigate.rs index a5839486..eb117d2e 100644 --- a/src/features/navigate.rs +++ b/src/features/navigate.rs @@ -1,6 +1,3 @@ -/// 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::OptionValueFunction; pub fn make_feature() -> Vec<(String, OptionValueFunction)> { @@ -42,6 +39,10 @@ mod tests { "Δ" ); assert_eq!( + features::tests::make_config(&["--navigate"], None, None).file_modified_label, + "Δ" + ); + assert_eq!( features::tests::make_config(&[], Some(git_config_contents), Some(git_config_path)) .file_modified_label, "modified: " diff --git a/src/set_options.rs b/src/set_options.rs index d520d46b..d456e948 100644 --- a/src/set_options.rs +++ b/src/set_options.rs @@ -26,6 +26,9 @@ pub fn set_options( if opt.color_only { opt.features = format!("{} color-only", opt.features); } + if opt.navigate { + opt.features = format!("{} navigate", opt.features); + } // Handle options which default to an arbitrary git config value. // TODO: incorporate this logic into the set_options macro. if !config::user_supplied_option("whitespace-error-style", arg_matches) { |