From aa8f576d59d0ed976bda2aef32199c1f74e6f32a Mon Sep 17 00:00:00 2001 From: Waleed Khan Date: Sat, 19 Aug 2023 14:13:00 -0700 Subject: [PATCH] merge_tools: reorder `editor_args_from_settings` --- cli/src/merge_tools/mod.rs | 42 +++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/cli/src/merge_tools/mod.rs b/cli/src/merge_tools/mod.rs index ab05351e9e..42c501b1e5 100644 --- a/cli/src/merge_tools/mod.rs +++ b/cli/src/merge_tools/mod.rs @@ -180,6 +180,27 @@ pub fn get_tool_config( } } +/// Finds the appropriate tool for diff editing or merges +fn editor_args_from_settings( + ui: &Ui, + settings: &UserSettings, + key: &str, +) -> Result { + // TODO: Make this configuration have a table of possible editors and detect the + // best one here. + if let Some(args) = settings.config().get(key).optional()? { + Ok(args) + } else { + let default_editor = "meld"; + writeln!( + ui.hint(), + "Using default editor '{default_editor}'; you can change this by setting {key}" + ) + .map_err(ExternalToolError::Io)?; + Ok(default_editor.into()) + } +} + /// Loads merge tool options from `[merge-tools.]` if `args` is of /// unstructured string type. pub fn get_tool_config_from_args( @@ -218,27 +239,6 @@ fn get_merge_tool_from_settings( } } -/// Finds the appropriate tool for diff editing or merges -fn editor_args_from_settings( - ui: &Ui, - settings: &UserSettings, - key: &str, -) -> Result { - // TODO: Make this configuration have a table of possible editors and detect the - // best one here. - if let Some(args) = settings.config().get(key).optional()? { - Ok(args) - } else { - let default_editor = "meld"; - writeln!( - ui.hint(), - "Using default editor '{default_editor}'; you can change this by setting {key}" - ) - .map_err(ExternalToolError::Io)?; - Ok(default_editor.into()) - } -} - #[cfg(test)] mod tests { use super::*;