Skip to content

Commit

Permalink
refactor: move status & diff modules into git module
Browse files Browse the repository at this point in the history
  • Loading branch information
altsem committed Feb 10, 2024
1 parent b11066b commit 4923ab2
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 11 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/diff/mod.rs → src/git/diff/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl Display for Diff {
}

#[derive(Parser)]
#[grammar = "diff/diff.pest"]
#[grammar = "git/diff/diff.pest"]
struct DiffParser;

impl Diff {
Expand Down
8 changes: 7 additions & 1 deletion src/git/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
use crate::{diff::Diff, status::Status, Res};
use std::{path::Path, process::Command, str};

use crate::Res;

use self::{diff::Diff, status::Status};

pub(crate) mod diff;
pub(crate) mod status;

// TODO Check for.git/index.lock and block if it exists
// TODO Use only plumbing commands

Expand Down
2 changes: 1 addition & 1 deletion src/status/mod.rs → src/git/status/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl StatusFile {
}

#[derive(Parser)]
#[grammar = "status/status.pest"] // relative to src
#[grammar = "git/status/status.pest"] // relative to src
struct StatusParser;

impl Status {
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions src/items.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::diff;
use crate::git::diff::Delta;
use crate::git::diff::Diff;
use crate::git::diff::Hunk;
use crate::theme;
use crate::theme::CURRENT_THEME;
use ansi_to_tui::IntoText;
use diff::Delta;
use diff::Hunk;
use ratatui::style::Color;
use ratatui::style::Modifier;
use ratatui::style::Style;
Expand Down Expand Up @@ -36,7 +36,7 @@ pub(crate) enum TargetData {
}

pub(crate) fn create_diff_items<'a>(
diff: &'a diff::Diff,
diff: &'a Diff,
depth: &'a usize,
) -> impl Iterator<Item = Item> + 'a {
diff.deltas.iter().flat_map(|delta| {
Expand Down
2 changes: 0 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
pub mod cli;
mod diff;
mod git;
mod items;
mod keybinds;
mod screen;
mod status;
mod theme;
mod ui;
mod util;
Expand Down
3 changes: 1 addition & 2 deletions src/screen/status.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use super::Screen;
use crate::{
diff::Diff,
git,
git::{self, diff::Diff},
items::{self, Item},
theme::CURRENT_THEME,
Config, Res,
Expand Down

0 comments on commit 4923ab2

Please sign in to comment.