diff --git a/CHANGELOG.md b/CHANGELOG.md index f286dca..dee31dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- Upgrade to gleisbau 0.7.3 + ## [0.1.21] - 2026-02-15 diff --git a/README.md b/README.md index 42c8d09..a7e8dfb 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ Decide for yourself which graph is the most comprehensible. :sunglasses: In case you have [Rust](https://www.rust-lang.org/) installed, you can install with `cargo`: ``` -cargo install git-igitt +cargo install --locked git-igitt ``` ## Usage diff --git a/src/lib.rs b/src/lib.rs deleted file mode 100644 index 5539f2f..0000000 --- a/src/lib.rs +++ /dev/null @@ -1,6 +0,0 @@ -pub mod app; -pub mod dialogs; -pub mod settings; -pub mod ui; -pub mod util; -pub mod widgets; diff --git a/src/main.rs b/src/main.rs index 85a860d..45b4f7d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,18 @@ +#![allow(clippy::collapsible_match)] + +pub mod app; +pub mod dialogs; +pub mod settings; +pub mod ui; +pub mod util; +pub mod widgets; + +use crate::app::DiffMode; +use crate::settings::AppSettings; +use crate::{ + app::{ActiveView, App, CurrentBranches}, + dialogs::FileDialog, +}; use clap::{crate_version, Arg, Command}; use crossterm::{ event::{self, Event as CEvent, KeyCode, KeyEventKind, KeyModifiers}, @@ -5,13 +20,6 @@ use crossterm::{ terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen}, }; use git2::Repository; -use git_igitt::app::DiffMode; -use git_igitt::settings::AppSettings; -use git_igitt::{ - app::{ActiveView, App, CurrentBranches}, - dialogs::FileDialog, - ui, -}; use gleisbau::{ config::{create_config, get_available_models, get_model, get_model_name}, get_repo, @@ -116,6 +124,7 @@ fn setup_logger(log_level: &str) { let _handle = log4rs::init_config(config).unwrap(); } +/// Parse command line arguments, read configuration, and run the application. fn from_args() -> Result<(), String> { let app_dir = AppDirs::new(Some("git-graph"), false).unwrap().config_dir; let mut models_dir = app_dir; @@ -433,6 +442,7 @@ fn from_args() -> Result<(), String> { Ok(()) } +/// Run the application fn run( mut repository: Option, mut settings: Settings, @@ -487,6 +497,7 @@ fn run( let next_file_update: &Cell> = &Cell::new(None); let mut reset_diff_scroll = false; + // Define lambda function "next_event" for reading one event let mut next_event = { let mut sx_old = 0; let mut sy_old = 0; @@ -531,6 +542,7 @@ fn run( let mut last_key = KeyCode::Esc; let mut key_repeat_time = INITIAL_KEY_REPEAT_TIME / 2; + // Event loop loop { app = if let Some(mut app) = app.take() { terminal.draw(|f| ui::draw(f, &mut app))?; @@ -974,7 +986,7 @@ pub fn set_model>( std::fs::write(&config_path, str).map_err(|err| { format!( "Can't write repository settings to file {}\n{}", - &config_path.display(), + config_path.display(), err ) })?; @@ -982,6 +994,7 @@ pub fn set_model>( Ok(()) } +/// Create an App instance, using the provided configuration fn create_app( repository: Repository, settings: &mut Settings, diff --git a/src/ui.rs b/src/ui.rs index 125845e..3cb4b70 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -33,7 +33,7 @@ pub fn draw_open_repo(f: &mut Frame, dialog: &mut FileDialog) { let location_block = Block::default().borders(Borders::ALL).title(" Path "); - let paragraph = Paragraph::new(format!("{}", &dialog.location.display())).block(location_block); + let paragraph = Paragraph::new(format!("{}", dialog.location.display())).block(location_block); f.render_widget(paragraph, top_chunks[0]); let help = Paragraph::new(" Navigate with Arrows, confirm with Enter, abort with Esc."); diff --git a/src/widgets/graph_view.rs b/src/widgets/graph_view.rs index e5a1ebf..87594fb 100644 --- a/src/widgets/graph_view.rs +++ b/src/widgets/graph_view.rs @@ -12,6 +12,7 @@ use unicode_width::UnicodeWidthStr; const SCROLL_MARGIN: usize = 3; const SCROLLBAR_STR: &str = "\u{2588}"; +/// State used to render widget [GraphView] #[derive(Default)] pub struct GraphViewState { pub graph: Option, @@ -86,6 +87,8 @@ impl GraphViewState { } } +/// Stateful widget for rendering the graph. The state is provided by +/// [GraphViewState] #[derive(Default)] pub struct GraphView<'a> { block: Option>,