From 337daa271780f95b4b19e4e9399cf59d236eb5df Mon Sep 17 00:00:00 2001 From: Tim Oram Date: Thu, 29 Oct 2020 11:53:55 -0230 Subject: Move git interactive to todo file module The GitInteractive stuct is one of the oldest structs in the project and was initially used as a catch-all for any functionality that was shared across the application. Overtime the functionality of this file has been moved into the various modules of the project. At this point, the only thing the struct handles is the direct interactions with the rebase todo file and it's lines. This finally moves the global stuct into a module. --- src/confirm_abort/mod.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/confirm_abort') diff --git a/src/confirm_abort/mod.rs b/src/confirm_abort/mod.rs index 39a4a6f..6e593a5 100644 --- a/src/confirm_abort/mod.rs +++ b/src/confirm_abort/mod.rs @@ -1,10 +1,10 @@ -use crate::git_interactive::GitInteractive; use crate::input::input_handler::{InputHandler, InputMode}; use crate::input::Input; use crate::process::exit_status::ExitStatus; use crate::process::process_module::ProcessModule; use crate::process::process_result::ProcessResult; use crate::process::state::State; +use crate::todo_file::TodoFile; use crate::view::view_data::ViewData; use crate::view::View; @@ -13,7 +13,7 @@ pub struct ConfirmAbort { } impl ProcessModule for ConfirmAbort { - fn build_view_data(&mut self, view: &View<'_>, _: &GitInteractive) -> &ViewData { + fn build_view_data(&mut self, view: &View<'_>, _: &TodoFile) -> &ViewData { let (window_width, window_height) = view.get_view_size(); self.view_data.set_view_size(window_width, window_height); self.view_data.rebuild(); @@ -23,7 +23,7 @@ impl ProcessModule for ConfirmAbort { fn handle_input( &mut self, input_handler: &InputHandler<'_>, - git_interactive: &mut GitInteractive, + rebase_todo: &mut TodoFile, _view: &View<'_>, ) -> ProcessResult { @@ -31,7 +31,7 @@ impl ProcessModule for ConfirmAbort { let mut result = ProcessResult::new().input(input); match input { Input::Yes => { - git_interactive.clear(); + rebase_todo.set_noop(); result = result.exit_status(ExitStatus::Good); }, Input::No => { @@ -90,7 +90,7 @@ mod tests { input = Input::Yes, exit_status = ExitStatus::Good ); - assert_eq!(test_context.git_interactive.get_lines().len(), 0); + assert_eq!(test_context.rebase_todo_file.get_lines().len(), 0); }, ); } -- cgit v1.2.3