chobs/lib.rs
1//! Chobs library entry points
2
3pub mod core;
4
5use crate::core::config::Config;
6use crate::core::watcher::Watcher;
7use std::path::PathBuf;
8
9/// Start watching process
10/// `folder_path` - directory to observe
11/// `exec` - command for process execution
12/// ```
13/// use chobs::watch;
14/// use std::path::PathBuf;
15///
16/// fn main() {
17/// watch(Some(PathBuf::from(".")), "cargo run".to_string());
18/// }
19/// ```
20pub fn watch(root_folder: Option<PathBuf>, exec: Option<String>) {
21 let mut watcher = Watcher::new(root_folder, exec);
22 watcher.watch();
23}
24
25/// Create chobs.json config file.
26/// If you already have this file, it will be overwritten.
27/// ```
28/// use chobs::init_config;
29///
30/// fn main() {
31/// init_config();
32/// }
33/// ```
34pub fn init_config() {
35 log_info!("Creating chobs.json ...");
36 Config::init().unwrap();
37}