From dcefe0f23d8f456fdf75056f2376231b3a3e5a04 Mon Sep 17 00:00:00 2001 From: uttarayan21 Date: Wed, 8 Oct 2025 03:06:29 +0530 Subject: [PATCH] feat(main): improve input handling and error reporting --- src/main.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 817966f..6a0b14e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,14 +5,23 @@ use std::path::{Path, PathBuf}; use errors::*; mod viewer; pub fn main() -> Result<()> { + error_stack::Report::set_color_mode(error_stack::fmt::ColorMode::Color); + error_stack::Report::set_charset(error_stack::fmt::Charset::Utf8); let args = ::parse(); if let Some(shell) = args.completions { cli::Cli::completions(shell); return Ok(()); } - let files = walker(args.input); + let input = args + .input + .canonicalize() + .change_context(Error) + .attach("Failed to canonicalize path")?; + let files = walker(&input); if files.is_empty() { - return Err(Error).attach("No files found"); + return Err(Error) + .attach("No files found in the folder") + .attach(input.display().to_string()); } viewer::run(files); @@ -33,6 +42,7 @@ fn walker(input: impl AsRef) -> Vec { .build() .expect("Failed to build type finder"), ) + .git_ignore(false) .sort_by_file_name(|a, b| a.cmp(b)) .build() .filter_map(|e| e.ok())