Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

2. `cd ducke`

3. For debug : `cargo build`
3. For debug (or to build locally): `cargo build`
For release: `cargo build --release`


4. To run debug : `./target/debug/ducke`
To run release : `./target/release/ducke`

Expand Down
14 changes: 12 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
use crossterm::event::{self, Event};
use ratatui::{Frame, text::Text};
mod utils;

fn main() {
// Check for git BEFORE initializing the terminal
if !utils::is_git_installed() {
eprintln!("Error: Git is not installed or not in PATH");
eprintln!("Please install Git to use this application. For details see: https://git-scm.com/install/");
std::process::exit(1);
}

println!("✓ Git is installed and ready!");
std::thread::sleep(std::time::Duration::from_secs(3));

let mut terminal = ratatui::init();
loop {
terminal.draw(draw).expect("failed to draw frame");

if matches!(event::read().expect("failed to read event"), Event::Key(_)) {
break;
}
Expand All @@ -16,4 +26,4 @@ fn main() {
fn draw(frame: &mut Frame) {
let text = Text::raw("Hello, World!");
frame.render_widget(text, frame.area());
}
}
9 changes: 9 additions & 0 deletions src/utils.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use std::process::Command;

pub fn is_git_installed() -> bool {
Command::new("git")
.arg("--version")
.output()
.map(|output| output.status.success())
.unwrap_or(false)
}