use crate::codegen::track_autogen::{add_to_file, track_autogen};
use path_abs::{PathAbs, PathInfo, PathOps};
use std::io::Result;
use std::process::Command;
pub fn git_rm(filepath: &str) {
Command::new("git")
.args(&["rm", "-f", filepath])
.output()
.unwrap_or_else(|_| {
panic!(
"Could not remove file from Git, please do so manually: {}",
filepath
)
});
}
pub fn git_ignore(file: &PathAbs) -> Result<()> {
let filename = file.file_name().unwrap().to_str().unwrap();
let gitignore = file.with_file_name(".gitignore");
track_autogen(gitignore.as_path().to_str().unwrap().to_owned());
add_to_file(&gitignore, ".gitignore")?;
add_to_file(&gitignore, filename)
}