cron_when/cli/actions/
file.rs1use crate::{crontab, output};
2use anyhow::Result;
3use std::path::Path;
4use tracing::{info, instrument};
5
6#[instrument(level = "info", fields(path = %path.display(), verbose = %verbose, color = %color))]
12pub fn execute(path: &Path, verbose: bool, color: bool) -> Result<()> {
13 info!("Parsing crontab file");
14 let entries = crontab::parse_file(path)?;
15 output::display_entries(&entries, verbose, color)?;
16 Ok(())
17}
18
19#[cfg(test)]
20mod tests {
21 use super::*;
22
23 #[test]
24 fn test_execute_file_not_found() {
25 let result = execute(Path::new("non_existent_file"), false, false);
26 assert!(result.is_err());
27 }
28}