Skip to main content

scan_path

Function scan_path 

Source
pub fn scan_path(
    path: impl AsRef<Path>,
    options: &ScanOptions,
) -> Result<Output>
Expand description

Scan a single native filesystem input through the supported high-level workflow facade.

use provenant::workflow::{scan_path, ScanOptions};
use std::fs;
use std::time::{SystemTime, UNIX_EPOCH};

let unique = SystemTime::now().duration_since(UNIX_EPOCH)?.as_nanos();
let root = std::env::temp_dir().join(format!("provenant-workflow-docs-{unique}"));
fs::create_dir_all(&root)?;
fs::write(root.join("README.txt"), "hello from doctest\n")?;

let output = scan_path(&root, &ScanOptions::default())?;
assert!(output.files.iter().any(|file| file.path.ends_with("README.txt")));
assert_eq!(output.headers.len(), 1);
assert!(!output.headers[0].options.contains_key("input"));

fs::remove_dir_all(&root)?;