summaryrefslogtreecommitdiffstats
path: root/src/main.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/main.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/main.rs')
-rw-r--r--src/main.rs17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/main.rs b/src/main.rs
index a9d84ca..eb1854a 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -36,25 +36,26 @@ mod constants;
mod display;
mod edit;
mod external_editor;
-mod git_interactive;
mod input;
mod list;
mod process;
mod show_commit;
+mod todo_file;
+mod view;
+
#[cfg(test)]
#[macro_use]
mod testutil;
-mod view;
use crate::config::Config;
use crate::constants::{NAME, VERSION};
use crate::display::curses::Curses;
use crate::display::Display;
-use crate::git_interactive::GitInteractive;
use crate::input::input_handler::InputHandler;
use crate::process::exit_status::ExitStatus;
use crate::process::modules::Modules;
use crate::process::Process;
+use crate::todo_file::TodoFile;
use crate::view::View;
use clap::{App, ArgMatches};
@@ -93,22 +94,22 @@ fn try_main(matches: &ArgMatches<'_>) -> Result<ExitStatus, Exit> {
}
})?;
- let mut git_interactive = GitInteractive::new(filepath, config.git.comment_char.as_str());
- git_interactive.load_file().map_err(|err| {
+ let mut todo_file = TodoFile::new(filepath, config.git.comment_char.as_str());
+ todo_file.load_file().map_err(|err| {
Exit {
message: err.to_string(),
status: ExitStatus::FileReadError,
}
})?;
- if git_interactive.is_noop() {
+ if todo_file.is_noop() {
return Err(Exit {
message: String::from("A noop rebase was provided, skipping editing"),
status: ExitStatus::Good,
});
}
- if git_interactive.get_lines().is_empty() {
+ if todo_file.get_lines().is_empty() {
return Err(Exit {
message: String::from("An empty rebase was provided, nothing to edit"),
status: ExitStatus::Good,
@@ -120,7 +121,7 @@ fn try_main(matches: &ArgMatches<'_>) -> Result<ExitStatus, Exit> {
let input_handler = InputHandler::new(&display, &config.key_bindings);
let view = View::new(&display, &config);
let modules = Modules::new(&display, &config);
- let mut process = Process::new(git_interactive, &view, &input_handler);
+ let mut process = Process::new(todo_file, &view, &input_handler);
let result = process.run(modules);
display.end();