1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
pub mod add; pub mod branch; pub mod commit; pub mod init; use std::{fs, io, path::Path}; #[macro_export] macro_rules! error { ($message:tt) => { io::Error::new(io::ErrorKind::Other, $message.to_string()) }; } pub fn in_repo() -> bool { Path::new(".rvcs").exists() && Path::new(".rvcs").is_dir() } pub fn get_current_branch() -> io::Result<String> { fs::read_to_string(".rvcs/CURRENT_BRANCH") } pub fn ok() -> String { "[ \x1b[0;32mok\x1b[0m ]".to_owned() }