1/// Basic usage example for noob-commit
2///
3/// This example demonstrates how to use noob-commit programmatically
4///
5/// Run with: cargo run --example basic_usage
67use noob_commit::Commit;
8use std::env;
910fn main() {
11// Example of creating a commit struct
12let 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 );
1617println!("Example commit title: {}", commit.title);
18println!("Example commit description: {}", commit.description);
19println!("\nFull commit message:\n{}", commit.to_string());
2021// Example of checking for API key
22match env::var("OPENAI_API_KEY") {
23Ok(_) => println!("✅ OpenAI API key is set"),
24Err(_) => println!("❌ OpenAI API key is not set. Set OPENAI_API_KEY environment variable"),
25 }
2627println!("\nTo use noob-commit:");
28println!("1. Stage your changes: git add .");
29println!("2. Run: noob-commit");
30println!("3. Or for dry run: noob-commit --dry-run");
31println!("4. To review before commit: noob-commit --review");
32}