Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add ignore flag for ignoring directories #102

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

elliottcrif
Copy link

@elliottcrif elliottcrif commented Dec 27, 2024

  • adds ignore flag to optionally ignore directories from being scanned
  • tests coming soon

Resolves #93

@elliottcrif elliottcrif force-pushed the feat/exclude-directory-flag branch from ed6d1c5 to 03939b1 Compare December 27, 2024 21:08
@@ -103,6 +112,7 @@ pub fn start<B>(
terminal_backend: B,
Copy link
Author

@elliottcrif elliottcrif Dec 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, the start function takes a growing list of parameters for various options and flags (e.g., show_apparent_size, disable_delete_confirmation). As we continue to add more options, this signature risks becoming unwieldy and harder to maintain. The challenge became especially apparent when updating the UI tests, which required significant changes due to the expanded parameter list.

To address this, I’ve started a WIP implementation that uses the Opt struct as the last argument in start. This encapsulates all optional parameters into a single structure, aiming to reduce churn when adding or modifying options.

I’d appreciate input on the following:

  • Is encapsulating options in a configuration struct like Opt an idiomatic approach in Rust?
  • Would a builder pattern provide better flexibility and maintainability for this use case?
  • Are there other patterns or techniques in Rust that would align well with the goal of minimizing signature changes?

I’m especially interested in feedback on how this impacts code readability, maintainability, and idiomatic usage in Rust.

@elliottcrif elliottcrif marked this pull request as ready for review December 28, 2024 19:38
@@ -53,6 +53,9 @@ pub struct Opt {
/// The folder to scan
folder: Option<PathBuf>,
#[structopt(short, long)]
/// The directories to ignore
ignore: Vec<PathBuf>,
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have opted to use an ignore option but wondering if we would prefer to use exclude with shorthand x, I have seen that preference voiced in other issues.

@elliottcrif
Copy link
Author

cc @imsnif @pjsier @pm100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: option --ignore to skip certain directory/directories
1 participant