rvcs_lib/
lib.rs

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