H72JG6HLA7U3XFOUMWF6F3NFSWK5B6ZM6J5ZTILRSXBA7IM6H75AC
RUBBHYZ7MCLKJIHZ3EWEC3JR3FSKOU4T2NH7KRBG7ECAU4JF3LUAC
Q7CHNDXNVJCBL2DK7LYZ6KSRFN4KO6TXKEP3GIWDJHB6JPSE3FUQC
BZSC7VMYSFRXDHDDAMCDR6X67FN5VWIBOSE76BQLX7OCVOJFUA3AC
SXEYMYF7P4RZMZ46WPL4IZUTSQ2ATBWYZX7QNVMS3SGOYXYOHAGQC
AEPEFS7O3YT7CRRFYQVJWUXUUSRGJ6K6XZQVK62B6N74UXOIFWYAC
ZBNKSYA6PW4DSPC3NCRUZLVHW2GNXMCSDSAGEIKHGHDGGZRBH7ZQC
LYTVEPH3W5UHF7MAYFWBT6NVNC42HEVKJGGMFDKUDZDNDOI33YJQC
EUZFFJSOWV4PXDFFPDAFBHFUUMOFEU6ST7JH57YYRRR2SEOXLN6QC
pub const DEFAULT_IGNORE: [&[u8]; 2] = [b".git", b".DS_Store"];
const DEFAULT_IGNORE: [&[u8]; 2] = [b".git", b".DS_Store"];
// Static KV map of names for project kinds |-> elements
// that should go in the `.ignore` file by default.
const IGNORE_KINDS: &[(&[&str], &[&[u8]])] = &[
(&["rust"], &[b"/target", b"Cargo.lock"]),
(&["node", "nodejs"], &[b"node_modules"]),
(&["lean"], &[b"/build"]),
];
ignore_specific(&mut dot_ignore, kind)
}
/// if `kind` matches any of the known project kinds, add the associated
/// .ignore entries to the default `.ignore` file.
fn ignore_specific(
dot_ignore: &mut std::fs::File,
kind: Option<&String>,
) -> Result<(), anyhow::Error> {
use std::io::Write;
if let Some(kind) = kind {
let entries = IGNORE_KINDS
.iter()
.find(|(names, _)| names.iter().any(|x| kind.eq_ignore_ascii_case(x)))
.into_iter()
.flat_map(|(_, v)| v.iter());
for entry in entries {
dot_ignore.write(entry)?;
dot_ignore.write(b"\n")?;
}
}