git-ai 0.1.30

Git AI: Automates commit messages using ChatGPT. Stage your files, and Git AI generates the messages.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use std::env;
use std::path::PathBuf;
pub trait Styled {
  fn relative_path(&self) -> PathBuf;
}

impl Styled for PathBuf {
  fn relative_path(&self) -> PathBuf {
    let current_dir = env::current_dir().unwrap();
    let relative_path = self
      .strip_prefix(&current_dir)
      .unwrap_or(current_dir.as_path());
    relative_path.to_path_buf()
  }
}