omni_dev/
core.rs

1//! Core functionality for omni-dev
2
3/// Core result type for omni-dev operations
4pub type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>;
5
6/// Main application context
7#[derive(Debug, Default)]
8pub struct App {
9    /// Application configuration
10    pub config: Config,
11}
12
13/// Configuration structure for omni-dev
14#[derive(Debug, Default)]
15pub struct Config {
16    /// Enable verbose output
17    pub verbose: bool,
18}
19
20impl App {
21    /// Create a new App instance
22    pub fn new() -> Self {
23        Self::default()
24    }
25
26    /// Create a new App instance with custom configuration
27    pub fn with_config(config: Config) -> Self {
28        Self { config }
29    }
30
31    /// Run the application
32    pub fn run(&self) -> Result<()> {
33        if self.config.verbose {
34            println!("Running omni-dev in verbose mode");
35        }
36
37        println!("omni-dev is ready!");
38        Ok(())
39    }
40}
41
42#[cfg(test)]
43mod tests {
44    use super::*;
45
46    #[test]
47    fn test_app_creation() {
48        let app = App::new();
49        assert!(!app.config.verbose);
50    }
51
52    #[test]
53    fn test_app_with_config() {
54        let config = Config { verbose: true };
55        let app = App::with_config(config);
56        assert!(app.config.verbose);
57    }
58
59    #[test]
60    fn test_app_run() {
61        let app = App::new();
62        assert!(app.run().is_ok());
63    }
64}