Skip to main content

forbidden_in

Function forbidden_in 

Source
pub fn forbidden_in(content: &str) -> Option<(&'static str, &'static str)>
Expand description

The first forbidden marker in content, with what it is, or None when the content is safe to publish.

The example joins the marker and a name at run time: this file is committed, and a committed file that named a home directory would fail the very gate the marker exists to keep the artifacts through.

use majordomus_cli::generate::forbidden_in;
assert!(forbidden_in("nodes are repository-relative").is_none());
let machine_path = format!("source: {}someone/dev", "/Users/");
assert_eq!(forbidden_in(&machine_path).map(|(m, _)| m), Some("/Users/"));