basic_usage/
basic_usage.rs1use noob_commit::Commit;
8use std::env;
9
10fn main() {
11 let commit = Commit::new(
13 "feat: add basic usage example".to_string(),
14 "This example demonstrates how to use noob-commit programmatically and shows the basic structure of commit messages.".to_string(),
15 );
16
17 println!("Example commit title: {}", commit.title);
18 println!("Example commit description: {}", commit.description);
19 println!("\nFull commit message:\n{}", commit.to_string());
20
21 match env::var("OPENAI_API_KEY") {
23 Ok(_) => println!("✅ OpenAI API key is set"),
24 Err(_) => println!("❌ OpenAI API key is not set. Set OPENAI_API_KEY environment variable"),
25 }
26
27 println!("\nTo use noob-commit:");
28 println!("1. Stage your changes: git add .");
29 println!("2. Run: noob-commit");
30 println!("3. Or for dry run: noob-commit --dry-run");
31 println!("4. To review before commit: noob-commit --review");
32}