summaryrefslogtreecommitdiffstats
path: root/src/confirm_rebase/mod.rs
diff options
context:
space:
mode:
authorTim Oram <dev@mitmaro.ca>2020-10-29 11:53:55 -0230
committerTim Oram <dev@mitmaro.ca>2020-10-29 21:23:19 -0230
commit337daa271780f95b4b19e4e9399cf59d236eb5df (patch)
tree918212621c5b9bc02f5978135490e622178b5410 /src/confirm_rebase/mod.rs
parent4cd7109b36d200b252c36dd29b23eb5c26a03989 (diff)
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.
Diffstat (limited to 'src/confirm_rebase/mod.rs')
-rw-r--r--src/confirm_rebase/mod.rs14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/confirm_rebase/mod.rs b/src/confirm_rebase/mod.rs
index 3561fcb..f8bfedd 100644
--- a/src/confirm_rebase/mod.rs
+++ b/src/confirm_rebase/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,20 +13,14 @@ pub struct ConfirmRebase {
}
impl ProcessModule for ConfirmRebase {
- 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();
&self.view_data
}
- fn handle_input(
- &mut self,
- input_handler: &InputHandler<'_>,
- _git_interactive: &mut GitInteractive,
- _view: &View<'_>,
- ) -> ProcessResult
- {
+ fn handle_input(&mut self, input_handler: &InputHandler<'_>, _: &mut TodoFile, _view: &View<'_>) -> ProcessResult {
let input = input_handler.get_input(InputMode::Confirm);
let mut result = ProcessResult::new().input(input);
match input {
@@ -89,7 +83,7 @@ mod tests {
input = Input::Yes,
exit_status = ExitStatus::Good
);
- assert_eq!(test_context.git_interactive.get_lines().len(), 1);
+ assert_eq!(test_context.rebase_todo_file.get_lines().len(), 1);
},
);
}