refactorisation in files

This commit is contained in:
2021-07-19 13:30:25 +02:00
parent a562c4616c
commit 1950a5312e
9 changed files with 32 additions and 26 deletions

21
src/gitutils/gitfile.rs Normal file
View File

@@ -0,0 +1,21 @@
use std::fmt::{Display, Formatter};
use std::path::{PathBuf};
use std::ffi::OsStr;
#[derive(Debug)]
pub struct GitFile(pub PathBuf);
impl GitFile {
pub(crate) fn new(fullname : PathBuf) -> GitFile {
GitFile(fullname)
}
pub fn name(&self) -> Option<&OsStr> {
self.0.file_name()
}
}
impl Display for GitFile {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.0.display())
}
}