diff --git a/src/lib.rs b/src/lib.rs index 0598d87..43da8d7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,3 +3,17 @@ pub use ccutils::Result; mod cli; mod config; mod syncer; + +pub fn cumain() -> Result<()> { + let cli = cli::parse(); + + // 设置日志级别 + match (cli.debug, cli.quiet) { + (true, _) => std::env::set_var("RUST_LOG", "debug"), + (false, true) => std::env::set_var("RUST_LOG", "error"), + _ => {}, + } + ccutils::set_up_logging()?; + + Ok(()) +} \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index e7a11a9..85cc02e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,3 @@ -fn main() { - println!("Hello, world!"); +fn main() -> cuweb_syncer::Result<()> { + cuweb_syncer::cumain() }