mirror of
https://forge.pointfixe.fr/hubert/gitust.git
synced 2026-02-05 01:27:28 +01:00
refactorisation in files
This commit is contained in:
21
src/gitutils/gitfile.rs
Normal file
21
src/gitutils/gitfile.rs
Normal 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())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user