Initial upload: GitPulse - Developer Productivity Analyzer CLI tool
Some checks failed
CI / test (push) Has been cancelled
CI / release (push) Has been cancelled

This commit is contained in:
2026-02-04 15:45:45 +00:00
parent e0d5542e18
commit cf21794b19

69
src/ui/app.rs Normal file
View File

@@ -0,0 +1,69 @@
use crate::config::Config;
use crate::models::AnalysisResult;
use anyhow::Result;
use std::path::PathBuf;
pub enum AppState {
Overview,
Contributors,
Churn,
Refactoring,
}
pub struct GitPulseApp {
pub current_view: AppState,
pub analysis_result: Option<AnalysisResult>,
pub config: Config,
pub should_quit: bool,
}
impl GitPulseApp {
pub fn new(config: Config) -> Self {
Self {
current_view: AppState::Overview,
analysis_result: None,
config,
should_quit: false,
}
}
pub fn set_result(&mut self, result: AnalysisResult) {
self.analysis_result = Some(result);
}
pub fn next_view(&mut self) {
self.current_view = match self.current_view {
AppState::Overview => AppState::Contributors,
AppState::Contributors => AppState::Churn,
AppState::Churn => AppState::Refactoring,
AppState::Refactoring => AppState::Overview,
};
}
pub fn previous_view(&mut self) {
self.current_view = match self.current_view {
AppState::Overview => AppState::Refactoring,
AppState::Contributors => AppState::Overview,
AppState::Churn => AppState::Contributors,
AppState::Refactoring => AppState::Churn,
};
}
pub fn handle_key(&mut self, key: char) {
match key {
'q' | 'Q' | '\x1b' => self.should_quit = true,
'n' | '\t' => self.next_view(),
'p' | '\x1b' => self.previous_view(),
'r' | 'R' => {
self.should_quit = true;
}
_ => {}
}
}
}
pub fn run(_repo_path: Option<PathBuf>, _config: &Config, _verbose: bool) -> Result<()> {
println!("Dashboard feature coming soon!");
println!("Use 'gitpulse analyze' for text-based output.");
Ok(())
}