From 4786f1e0f58efca27e34d94c73feb7d1ad795b84 Mon Sep 17 00:00:00 2001 From: Marcel Schneider Date: Thu, 5 Mar 2020 12:14:20 +0100 Subject: [PATCH] Add log entry --- .gitignore | 1 + src/app.rs | 3 ++- src/gitignore.rs | 6 ++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 06dbbc4..5af836c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /callgrind.out.justfile /dist /target +tags diff --git a/src/app.rs b/src/app.rs index 0728351..030542f 100644 --- a/src/app.rs +++ b/src/app.rs @@ -8,7 +8,7 @@ use std::path::PathBuf; use directories::ProjectDirs; use structopt::StructOpt; -use log::{info, trace}; +use log::{debug, info, trace}; // Local Imports use crate::cache::File as FileCache; @@ -88,6 +88,7 @@ fn run_add(glob: &str) -> Result<()> { file_path.push(".gitignore"); let gitig = Gitignore::from_path(&file_path); gitig.add_line(glob)?; + debug!("Added '{}' to {}", glob, gitig); Ok(()) } diff --git a/src/gitignore.rs b/src/gitignore.rs index 97e2acf..9094bd8 100644 --- a/src/gitignore.rs +++ b/src/gitignore.rs @@ -27,3 +27,9 @@ impl Gitignore { Ok(()) } } + +impl std::fmt::Display for Gitignore { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> { + write!(f, "gitignore file {}", self.path.to_string_lossy()) + } +}